typescript-ds-lib 0.2.5 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/binary-search-tree.ts +218 -0
- package/lib/deque.ts +86 -0
- package/lib/hash-table.ts +179 -0
- package/lib/linked-list.ts +314 -0
- package/lib/map.ts +55 -0
- package/lib/matrix.ts +427 -0
- package/lib/priority-queue.ts +71 -0
- package/lib/queue.ts +62 -0
- package/lib/red-black-tree.ts +350 -0
- package/lib/set.ts +83 -0
- package/lib/stack.ts +59 -0
- package/package.json +7 -3
- package/types/index.ts +1 -0
- package/dist/tests/binary-search-tree.test.d.ts +0 -1
- package/dist/tests/binary-search-tree.test.js +0 -163
- package/dist/tests/binary-search-tree.test.js.map +0 -1
- package/dist/tests/deque.test.d.ts +0 -1
- package/dist/tests/deque.test.js +0 -78
- package/dist/tests/deque.test.js.map +0 -1
- package/dist/tests/hash-table.test.d.ts +0 -1
- package/dist/tests/hash-table.test.js +0 -94
- package/dist/tests/hash-table.test.js.map +0 -1
- package/dist/tests/linked-list.test.d.ts +0 -1
- package/dist/tests/linked-list.test.js +0 -344
- package/dist/tests/linked-list.test.js.map +0 -1
- package/dist/tests/map.test.d.ts +0 -1
- package/dist/tests/map.test.js +0 -176
- package/dist/tests/map.test.js.map +0 -1
- package/dist/tests/matrix.test.d.ts +0 -1
- package/dist/tests/matrix.test.js +0 -278
- package/dist/tests/matrix.test.js.map +0 -1
- package/dist/tests/priority-queue.test.d.ts +0 -1
- package/dist/tests/priority-queue.test.js +0 -118
- package/dist/tests/priority-queue.test.js.map +0 -1
- package/dist/tests/queue.test.d.ts +0 -1
- package/dist/tests/queue.test.js +0 -48
- package/dist/tests/queue.test.js.map +0 -1
- package/dist/tests/red-black-tree.test.d.ts +0 -1
- package/dist/tests/red-black-tree.test.js +0 -167
- package/dist/tests/red-black-tree.test.js.map +0 -1
- package/dist/tests/set.test.d.ts +0 -1
- package/dist/tests/set.test.js +0 -119
- package/dist/tests/set.test.js.map +0 -1
- package/dist/tests/stack.test.d.ts +0 -1
- package/dist/tests/stack.test.js +0 -57
- package/dist/tests/stack.test.js.map +0 -1
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
import { Comparator } from '../types';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export interface RedBlackTree<K, V> {
|
|
5
|
+
insert(key: K, value: V): void;
|
|
6
|
+
remove(key: K): void;
|
|
7
|
+
find(key: K): V | undefined;
|
|
8
|
+
min(): V | undefined;
|
|
9
|
+
max(): V | undefined;
|
|
10
|
+
forEach(callback: (key: K, value: V) => void): void;
|
|
11
|
+
isEmpty(): boolean;
|
|
12
|
+
size(): number;
|
|
13
|
+
clear(): void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
enum Color {
|
|
18
|
+
RED,
|
|
19
|
+
BLACK
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class RBNode<K, V> {
|
|
24
|
+
key: K;
|
|
25
|
+
value: V;
|
|
26
|
+
color: Color;
|
|
27
|
+
left: RBNode<K, V> | null;
|
|
28
|
+
right: RBNode<K, V> | null;
|
|
29
|
+
parent: RBNode<K, V> | null;
|
|
30
|
+
|
|
31
|
+
constructor(key: K, value: V) {
|
|
32
|
+
this.key = key;
|
|
33
|
+
this.value = value;
|
|
34
|
+
this.color = Color.RED;
|
|
35
|
+
this.left = null;
|
|
36
|
+
this.right = null;
|
|
37
|
+
this.parent = null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
export class RedBlackTree<K, V> implements RedBlackTree<K, V> {
|
|
43
|
+
private root: RBNode<K, V> | null;
|
|
44
|
+
private nodeCount: number;
|
|
45
|
+
private comparator: Comparator<K>;
|
|
46
|
+
|
|
47
|
+
constructor(comparator: Comparator<K> = (a: K, b: K) => a < b) {
|
|
48
|
+
this.root = null;
|
|
49
|
+
this.nodeCount = 0;
|
|
50
|
+
this.comparator = comparator;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
private rotateLeft(node: RBNode<K, V>): void {
|
|
54
|
+
const rightChild = node.right!;
|
|
55
|
+
node.right = rightChild.left;
|
|
56
|
+
if (rightChild.left !== null) {
|
|
57
|
+
rightChild.left.parent = node;
|
|
58
|
+
}
|
|
59
|
+
rightChild.parent = node.parent;
|
|
60
|
+
if (node.parent === null) {
|
|
61
|
+
this.root = rightChild;
|
|
62
|
+
} else if (node === node.parent.left) {
|
|
63
|
+
node.parent.left = rightChild;
|
|
64
|
+
} else {
|
|
65
|
+
node.parent.right = rightChild;
|
|
66
|
+
}
|
|
67
|
+
rightChild.left = node;
|
|
68
|
+
node.parent = rightChild;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private rotateRight(node: RBNode<K, V>): void {
|
|
72
|
+
const leftChild = node.left!;
|
|
73
|
+
node.left = leftChild.right;
|
|
74
|
+
if (leftChild.right !== null) {
|
|
75
|
+
leftChild.right.parent = node;
|
|
76
|
+
}
|
|
77
|
+
leftChild.parent = node.parent;
|
|
78
|
+
if (node.parent === null) {
|
|
79
|
+
this.root = leftChild;
|
|
80
|
+
} else if (node === node.parent.right) {
|
|
81
|
+
node.parent.right = leftChild;
|
|
82
|
+
} else {
|
|
83
|
+
node.parent.left = leftChild;
|
|
84
|
+
}
|
|
85
|
+
leftChild.right = node;
|
|
86
|
+
node.parent = leftChild;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
private fixInsert(node: RBNode<K, V>): void {
|
|
90
|
+
while (node !== this.root && node.parent?.color === Color.RED) {
|
|
91
|
+
if (node.parent === node.parent.parent?.left) {
|
|
92
|
+
const uncle = node.parent.parent.right;
|
|
93
|
+
|
|
94
|
+
if (uncle?.color === Color.RED) {
|
|
95
|
+
node.parent.color = Color.BLACK;
|
|
96
|
+
uncle.color = Color.BLACK;
|
|
97
|
+
node.parent.parent.color = Color.RED;
|
|
98
|
+
node = node.parent.parent;
|
|
99
|
+
} else {
|
|
100
|
+
if (node === node.parent.right) {
|
|
101
|
+
node = node.parent;
|
|
102
|
+
this.rotateLeft(node);
|
|
103
|
+
}
|
|
104
|
+
node.parent!.color = Color.BLACK;
|
|
105
|
+
node.parent!.parent!.color = Color.RED;
|
|
106
|
+
this.rotateRight(node.parent!.parent!);
|
|
107
|
+
}
|
|
108
|
+
} else {
|
|
109
|
+
const uncle = node.parent.parent?.left;
|
|
110
|
+
if (uncle?.color === Color.RED) {
|
|
111
|
+
node.parent.color = Color.BLACK;
|
|
112
|
+
uncle.color = Color.BLACK;
|
|
113
|
+
node.parent.parent!.color = Color.RED;
|
|
114
|
+
node = node.parent.parent!;
|
|
115
|
+
} else {
|
|
116
|
+
if (node === node.parent.left) {
|
|
117
|
+
node = node.parent;
|
|
118
|
+
this.rotateRight(node);
|
|
119
|
+
}
|
|
120
|
+
node.parent!.color = Color.BLACK;
|
|
121
|
+
node.parent!.parent!.color = Color.RED;
|
|
122
|
+
this.rotateLeft(node.parent!.parent!);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
this.root!.color = Color.BLACK;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
insert(key: K, value: V): void {
|
|
130
|
+
const newNode = new RBNode(key, value);
|
|
131
|
+
let parent: RBNode<K, V> | null = null;
|
|
132
|
+
let current = this.root;
|
|
133
|
+
while (current !== null) {
|
|
134
|
+
parent = current;
|
|
135
|
+
if (this.comparator(key, current.key)) {
|
|
136
|
+
current = current.left;
|
|
137
|
+
} else if (this.comparator(current.key, key)) {
|
|
138
|
+
current = current.right;
|
|
139
|
+
} else {
|
|
140
|
+
// Key already exists, update value
|
|
141
|
+
current.value = value;
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
newNode.parent = parent;
|
|
147
|
+
|
|
148
|
+
if (parent === null) {
|
|
149
|
+
this.root = newNode;
|
|
150
|
+
} else if (this.comparator(key, parent.key)) {
|
|
151
|
+
parent.left = newNode;
|
|
152
|
+
} else {
|
|
153
|
+
parent.right = newNode;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
this.nodeCount++;
|
|
157
|
+
this.fixInsert(newNode);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
private findNode(key: K): RBNode<K, V> | null {
|
|
161
|
+
let current = this.root;
|
|
162
|
+
while (current !== null) {
|
|
163
|
+
if (this.isEqual(key, current.key)) {
|
|
164
|
+
return current;
|
|
165
|
+
}
|
|
166
|
+
current = this.comparator(key, current.key) ? current.left : current.right;
|
|
167
|
+
}
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
find(key: K): V | undefined {
|
|
172
|
+
const node = this.findNode(key);
|
|
173
|
+
return node ? node.value : undefined;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
private findMinNode(node: RBNode<K, V>): RBNode<K, V> {
|
|
177
|
+
let current = node;
|
|
178
|
+
while (current.left !== null) {
|
|
179
|
+
current = current.left;
|
|
180
|
+
}
|
|
181
|
+
return current;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
min(): V | undefined {
|
|
185
|
+
if (!this.root) return undefined;
|
|
186
|
+
return this.findMinNode(this.root).value;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
private findMaxNode(node: RBNode<K, V>): RBNode<K, V> {
|
|
190
|
+
let current = node;
|
|
191
|
+
while (current.right !== null) {
|
|
192
|
+
current = current.right;
|
|
193
|
+
}
|
|
194
|
+
return current;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
max(): V | undefined {
|
|
198
|
+
if (!this.root) return undefined;
|
|
199
|
+
return this.findMaxNode(this.root).value;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
remove(key: K): void {
|
|
203
|
+
const node = this.findNode(key);
|
|
204
|
+
if (node) {
|
|
205
|
+
this.nodeCount--;
|
|
206
|
+
this.deleteNode(node);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
private deleteNode(node: RBNode<K, V>): void {
|
|
211
|
+
let x: RBNode<K, V> | null;
|
|
212
|
+
let y = node;
|
|
213
|
+
let originalColor = y.color;
|
|
214
|
+
|
|
215
|
+
if (node.left === null) {
|
|
216
|
+
x = node.right;
|
|
217
|
+
this.transplant(node, node.right);
|
|
218
|
+
} else if (node.right === null) {
|
|
219
|
+
x = node.left;
|
|
220
|
+
this.transplant(node, node.left);
|
|
221
|
+
} else {
|
|
222
|
+
y = this.findMinNode(node.right);
|
|
223
|
+
originalColor = y.color;
|
|
224
|
+
x = y.right;
|
|
225
|
+
|
|
226
|
+
if (y.parent === node) {
|
|
227
|
+
if (x) x.parent = y;
|
|
228
|
+
} else {
|
|
229
|
+
this.transplant(y, y.right);
|
|
230
|
+
y.right = node.right;
|
|
231
|
+
y.right.parent = y;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
this.transplant(node, y);
|
|
235
|
+
y.left = node.left;
|
|
236
|
+
y.left.parent = y;
|
|
237
|
+
y.color = node.color;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
if (originalColor === Color.BLACK && x) {
|
|
241
|
+
this.fixDelete(x);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
private transplant(u: RBNode<K, V>, v: RBNode<K, V> | null): void {
|
|
246
|
+
if (u.parent === null) {
|
|
247
|
+
this.root = v;
|
|
248
|
+
} else if (u === u.parent.left) {
|
|
249
|
+
u.parent.left = v;
|
|
250
|
+
} else {
|
|
251
|
+
u.parent.right = v;
|
|
252
|
+
}
|
|
253
|
+
if (v !== null) {
|
|
254
|
+
v.parent = u.parent;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
private fixDelete(x: RBNode<K, V>): void {
|
|
259
|
+
while (x !== this.root && x.color === Color.BLACK) {
|
|
260
|
+
if (x === x.parent!.left) {
|
|
261
|
+
let w = x.parent!.right!;
|
|
262
|
+
|
|
263
|
+
if (w.color === Color.RED) {
|
|
264
|
+
w.color = Color.BLACK;
|
|
265
|
+
x.parent!.color = Color.RED;
|
|
266
|
+
this.rotateLeft(x.parent!);
|
|
267
|
+
w = x.parent!.right!;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if ((!w.left || w.left.color === Color.BLACK) &&
|
|
271
|
+
(!w.right || w.right.color === Color.BLACK)) {
|
|
272
|
+
w.color = Color.RED;
|
|
273
|
+
x = x.parent!;
|
|
274
|
+
} else {
|
|
275
|
+
if (!w.right || w.right.color === Color.BLACK) {
|
|
276
|
+
if (w.left) w.left.color = Color.BLACK;
|
|
277
|
+
w.color = Color.RED;
|
|
278
|
+
this.rotateRight(w);
|
|
279
|
+
w = x.parent!.right!;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
w.color = x.parent!.color;
|
|
283
|
+
x.parent!.color = Color.BLACK;
|
|
284
|
+
if (w.right) w.right.color = Color.BLACK;
|
|
285
|
+
this.rotateLeft(x.parent!);
|
|
286
|
+
x = this.root!;
|
|
287
|
+
}
|
|
288
|
+
} else {
|
|
289
|
+
let w = x.parent!.left!;
|
|
290
|
+
|
|
291
|
+
if (w.color === Color.RED) {
|
|
292
|
+
w.color = Color.BLACK;
|
|
293
|
+
x.parent!.color = Color.RED;
|
|
294
|
+
this.rotateRight(x.parent!);
|
|
295
|
+
w = x.parent!.left!;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
if ((!w.right || w.right.color === Color.BLACK) &&
|
|
299
|
+
(!w.left || w.left.color === Color.BLACK)) {
|
|
300
|
+
w.color = Color.RED;
|
|
301
|
+
x = x.parent!;
|
|
302
|
+
} else {
|
|
303
|
+
if (!w.left || w.left.color === Color.BLACK) {
|
|
304
|
+
if (w.right) w.right.color = Color.BLACK;
|
|
305
|
+
w.color = Color.RED;
|
|
306
|
+
this.rotateLeft(w);
|
|
307
|
+
w = x.parent!.left!;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
w.color = x.parent!.color;
|
|
311
|
+
x.parent!.color = Color.BLACK;
|
|
312
|
+
if (w.left) w.left.color = Color.BLACK;
|
|
313
|
+
this.rotateRight(x.parent!);
|
|
314
|
+
x = this.root!;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
x.color = Color.BLACK;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
isEmpty(): boolean {
|
|
322
|
+
return this.root === null;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
size(): number {
|
|
326
|
+
return this.nodeCount;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
clear(): void {
|
|
330
|
+
this.root = null;
|
|
331
|
+
this.nodeCount = 0;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
private isEqual(a: K, b: K): boolean {
|
|
335
|
+
// Two values are equal if neither is less than the other
|
|
336
|
+
return !this.comparator(a, b) && !this.comparator(b, a);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
private inorderTraversal(node: RBNode<K, V> | null, callback: (key: K, value: V) => void): void {
|
|
340
|
+
if (node !== null) {
|
|
341
|
+
this.inorderTraversal(node.left, callback);
|
|
342
|
+
callback(node.key, node.value);
|
|
343
|
+
this.inorderTraversal(node.right, callback);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
forEach(callback: (key: K, value: V) => void): void {
|
|
348
|
+
this.inorderTraversal(this.root, callback);
|
|
349
|
+
}
|
|
350
|
+
}
|
package/lib/set.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Comparator } from '../types';
|
|
2
|
+
import { BinarySearchTree } from './binary-search-tree';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export interface Set<T> {
|
|
6
|
+
insert(element: T): void;
|
|
7
|
+
insertList(elements: T[]): void;
|
|
8
|
+
remove(element: T): void;
|
|
9
|
+
find(element: T): boolean;
|
|
10
|
+
forEach(callback: (element: T) => void): void;
|
|
11
|
+
isEmpty(): boolean;
|
|
12
|
+
size(): number;
|
|
13
|
+
clear(): void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
export class Set<T> implements Set<T> {
|
|
18
|
+
private bst: BinarySearchTree<T>;
|
|
19
|
+
|
|
20
|
+
constructor(comparator: Comparator<T> = (a: T, b: T) => a < b) {
|
|
21
|
+
this.bst = new BinarySearchTree<T>(comparator);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Adds a value to the set if it's not already present
|
|
26
|
+
*/
|
|
27
|
+
insert(value: T): void {
|
|
28
|
+
if (!this.find(value)) {
|
|
29
|
+
this.bst.insert(value);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Adds multiple values to the set if they're not already present
|
|
35
|
+
*/
|
|
36
|
+
insertList(values: T[]): void {
|
|
37
|
+
for (const value of values) {
|
|
38
|
+
this.insert(value);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Checks if a value exists in the set
|
|
44
|
+
*/
|
|
45
|
+
find(value: T): boolean {
|
|
46
|
+
return this.bst.find(value);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Removes a value from the set
|
|
51
|
+
*/
|
|
52
|
+
remove(value: T): void {
|
|
53
|
+
this.bst.remove(value);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Executes a callback function for each element in the set
|
|
58
|
+
*/
|
|
59
|
+
forEach(callback: (element: T) => void): void {
|
|
60
|
+
this.bst.forEach(callback);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Removes all elements from the set
|
|
65
|
+
*/
|
|
66
|
+
clear(): void {
|
|
67
|
+
this.bst = new BinarySearchTree<T>();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Returns true if the set contains no elements
|
|
72
|
+
*/
|
|
73
|
+
isEmpty(): boolean {
|
|
74
|
+
return this.bst.isEmpty();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Returns the number of elements in the set
|
|
79
|
+
*/
|
|
80
|
+
size(): number {
|
|
81
|
+
return this.bst.count();
|
|
82
|
+
}
|
|
83
|
+
}
|
package/lib/stack.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export interface Stack<T> {
|
|
2
|
+
push(element: T): void;
|
|
3
|
+
pop(): T | undefined;
|
|
4
|
+
top(): T | undefined;
|
|
5
|
+
isEmpty(): boolean;
|
|
6
|
+
size(): number;
|
|
7
|
+
clear(): void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
export class Stack<T> implements Stack<T> {
|
|
12
|
+
private items: T[];
|
|
13
|
+
|
|
14
|
+
constructor() {
|
|
15
|
+
this.items = [];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Adds an element to the top of the stack.
|
|
20
|
+
*/
|
|
21
|
+
push(element: T): void {
|
|
22
|
+
this.items.push(element);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Removes and returns the top element from the stack, or undefined if stack is empty.
|
|
27
|
+
*/
|
|
28
|
+
pop(): T | undefined {
|
|
29
|
+
return this.items.pop();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Returns the top element of the stack without removing it, or undefined if stack is empty.
|
|
34
|
+
*/
|
|
35
|
+
top(): T | undefined {
|
|
36
|
+
return this.items[this.items.length - 1];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Checks if the stack is empty. Returns true if the stack is empty, false otherwise.
|
|
41
|
+
*/
|
|
42
|
+
isEmpty(): boolean {
|
|
43
|
+
return this.items.length === 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Returns the number of elements in the stack. The size of the stack
|
|
48
|
+
*/
|
|
49
|
+
size(): number {
|
|
50
|
+
return this.items.length;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Removes all elements from the stack.
|
|
55
|
+
*/
|
|
56
|
+
clear(): void {
|
|
57
|
+
this.items = [];
|
|
58
|
+
}
|
|
59
|
+
}
|
package/package.json
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typescript-ds-lib",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "A collection of TypeScript data structure implementations",
|
|
5
5
|
"author": "Artiom Baloian <artiom.baloian@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
9
|
"files": [
|
|
10
|
-
"dist"
|
|
10
|
+
"dist",
|
|
11
|
+
"lib",
|
|
12
|
+
"types",
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE"
|
|
11
15
|
],
|
|
12
16
|
"scripts": {
|
|
13
17
|
"build": "rm -rf dist && tsc",
|
|
14
|
-
"prepare": "npm run build",
|
|
18
|
+
"prepare": "npm run build",
|
|
15
19
|
"test": "rm -rf dist && tsc && jest"
|
|
16
20
|
},
|
|
17
21
|
"repository": {
|
package/types/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Comparator<T> = (a: T, b: T) => boolean;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const binary_search_tree_1 = require("../lib/binary-search-tree");
|
|
4
|
-
describe('BinarySearchTree', () => {
|
|
5
|
-
let bst;
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
bst = new binary_search_tree_1.BinarySearchTree();
|
|
8
|
-
});
|
|
9
|
-
describe('Basic Operations', () => {
|
|
10
|
-
test('should create empty tree', () => {
|
|
11
|
-
expect(bst.isEmpty()).toBe(true);
|
|
12
|
-
expect(bst.count()).toBe(0);
|
|
13
|
-
});
|
|
14
|
-
test('should insert and search values', () => {
|
|
15
|
-
bst.insert(5);
|
|
16
|
-
bst.insert(3);
|
|
17
|
-
bst.insert(7);
|
|
18
|
-
expect(bst.find(5)).toBe(true);
|
|
19
|
-
expect(bst.find(3)).toBe(true);
|
|
20
|
-
expect(bst.find(7)).toBe(true);
|
|
21
|
-
expect(bst.find(1)).toBe(false);
|
|
22
|
-
expect(bst.count()).toBe(3);
|
|
23
|
-
expect(bst.isEmpty()).toBe(false);
|
|
24
|
-
});
|
|
25
|
-
test('should clear all nodes from tree', () => {
|
|
26
|
-
bst.insert(5);
|
|
27
|
-
bst.insert(3);
|
|
28
|
-
bst.insert(7);
|
|
29
|
-
bst.clear();
|
|
30
|
-
expect(bst.isEmpty()).toBe(true);
|
|
31
|
-
expect(bst.find(5)).toBe(false);
|
|
32
|
-
expect(bst.min()).toBeUndefined();
|
|
33
|
-
expect(bst.max()).toBeUndefined();
|
|
34
|
-
expect(bst.count()).toBe(0);
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
describe('Min/Max Operations', () => {
|
|
38
|
-
test('should find min and max values', () => {
|
|
39
|
-
bst.insert(5);
|
|
40
|
-
bst.insert(3);
|
|
41
|
-
bst.insert(7);
|
|
42
|
-
bst.insert(1);
|
|
43
|
-
bst.insert(9);
|
|
44
|
-
expect(bst.min()).toBe(1);
|
|
45
|
-
expect(bst.max()).toBe(9);
|
|
46
|
-
});
|
|
47
|
-
test('should return undefined min/max for empty tree', () => {
|
|
48
|
-
expect(bst.min()).toBeUndefined();
|
|
49
|
-
expect(bst.max()).toBeUndefined();
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
describe('Remove Operations', () => {
|
|
53
|
-
test('should remove leaf nodes', () => {
|
|
54
|
-
bst.insert(5);
|
|
55
|
-
bst.insert(3);
|
|
56
|
-
bst.insert(7);
|
|
57
|
-
bst.remove(3);
|
|
58
|
-
expect(bst.find(3)).toBe(false);
|
|
59
|
-
expect(bst.find(5)).toBe(true);
|
|
60
|
-
expect(bst.find(7)).toBe(true);
|
|
61
|
-
expect(bst.count()).toBe(2);
|
|
62
|
-
});
|
|
63
|
-
test('should remove nodes with one child', () => {
|
|
64
|
-
bst.insert(5);
|
|
65
|
-
bst.insert(3);
|
|
66
|
-
bst.insert(2);
|
|
67
|
-
bst.remove(3);
|
|
68
|
-
expect(bst.find(3)).toBe(false);
|
|
69
|
-
expect(bst.find(5)).toBe(true);
|
|
70
|
-
expect(bst.find(2)).toBe(true);
|
|
71
|
-
expect(bst.count()).toBe(2);
|
|
72
|
-
});
|
|
73
|
-
test('should remove nodes with two children', () => {
|
|
74
|
-
bst.insert(5);
|
|
75
|
-
bst.insert(3);
|
|
76
|
-
bst.insert(7);
|
|
77
|
-
bst.insert(6);
|
|
78
|
-
bst.insert(8);
|
|
79
|
-
bst.remove(7);
|
|
80
|
-
expect(bst.find(7)).toBe(false);
|
|
81
|
-
expect(bst.find(5)).toBe(true);
|
|
82
|
-
expect(bst.find(8)).toBe(true);
|
|
83
|
-
expect(bst.find(6)).toBe(true);
|
|
84
|
-
expect(bst.count()).toBe(4);
|
|
85
|
-
});
|
|
86
|
-
test('should handle removing root node', () => {
|
|
87
|
-
bst.insert(5);
|
|
88
|
-
bst.insert(3);
|
|
89
|
-
bst.insert(7);
|
|
90
|
-
bst.remove(5);
|
|
91
|
-
expect(bst.find(5)).toBe(false);
|
|
92
|
-
expect(bst.find(3)).toBe(true);
|
|
93
|
-
expect(bst.find(7)).toBe(true);
|
|
94
|
-
expect(bst.count()).toBe(2);
|
|
95
|
-
});
|
|
96
|
-
test('should handle removing non-existent values', () => {
|
|
97
|
-
bst.insert(5);
|
|
98
|
-
bst.insert(3);
|
|
99
|
-
bst.remove(7);
|
|
100
|
-
expect(bst.count()).toBe(2);
|
|
101
|
-
expect(bst.find(5)).toBe(true);
|
|
102
|
-
expect(bst.find(3)).toBe(true);
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
describe('Special Cases', () => {
|
|
106
|
-
test('should maintain order with duplicate values', () => {
|
|
107
|
-
const bst = new binary_search_tree_1.BinarySearchTree();
|
|
108
|
-
bst.insert(5);
|
|
109
|
-
bst.insert(5);
|
|
110
|
-
bst.insert(5);
|
|
111
|
-
expect(bst.count()).toBe(3);
|
|
112
|
-
bst.remove(5);
|
|
113
|
-
expect(bst.count()).toBe(2);
|
|
114
|
-
expect(bst.find(5)).toBe(true);
|
|
115
|
-
});
|
|
116
|
-
test('should work with custom comparator', () => {
|
|
117
|
-
const reverseBst = new binary_search_tree_1.BinarySearchTree((a, b) => a > b);
|
|
118
|
-
reverseBst.insert(5);
|
|
119
|
-
reverseBst.insert(3);
|
|
120
|
-
reverseBst.insert(7);
|
|
121
|
-
expect(reverseBst.min()).toBe(7);
|
|
122
|
-
expect(reverseBst.max()).toBe(3);
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
describe('Traversal Operations', () => {
|
|
126
|
-
test('should traverse tree in-order', () => {
|
|
127
|
-
bst.insert(5);
|
|
128
|
-
bst.insert(3);
|
|
129
|
-
bst.insert(7);
|
|
130
|
-
bst.insert(1);
|
|
131
|
-
bst.insert(9);
|
|
132
|
-
const result = [];
|
|
133
|
-
bst.forEach((value) => result.push(value));
|
|
134
|
-
expect(result).toEqual([1, 3, 5, 7, 9]);
|
|
135
|
-
});
|
|
136
|
-
test('should traverse tree pre-order', () => {
|
|
137
|
-
bst.insert(5);
|
|
138
|
-
bst.insert(3);
|
|
139
|
-
bst.insert(7);
|
|
140
|
-
bst.insert(1);
|
|
141
|
-
bst.insert(9);
|
|
142
|
-
const result = [];
|
|
143
|
-
bst.forEach((value) => result.push(value), 'preorder');
|
|
144
|
-
expect(result).toEqual([5, 3, 1, 7, 9]);
|
|
145
|
-
});
|
|
146
|
-
test('should traverse tree post-order', () => {
|
|
147
|
-
bst.insert(5);
|
|
148
|
-
bst.insert(3);
|
|
149
|
-
bst.insert(7);
|
|
150
|
-
bst.insert(1);
|
|
151
|
-
bst.insert(9);
|
|
152
|
-
const result = [];
|
|
153
|
-
bst.forEach((value) => result.push(value), 'postorder');
|
|
154
|
-
expect(result).toEqual([1, 3, 9, 7, 5]);
|
|
155
|
-
});
|
|
156
|
-
test('should handle forEach on empty tree', () => {
|
|
157
|
-
const result = [];
|
|
158
|
-
bst.forEach((value) => result.push(value));
|
|
159
|
-
expect(result).toEqual([]);
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
//# sourceMappingURL=binary-search-tree.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"binary-search-tree.test.js","sourceRoot":"","sources":["../../tests/binary-search-tree.test.ts"],"names":[],"mappings":";;AAAA,kEAA6D;AAE7D,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,IAAI,GAA6B,CAAC;IAElC,UAAU,CAAC,GAAG,EAAE;QACd,GAAG,GAAG,IAAI,qCAAgB,EAAU,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,IAAI,CAAC,0BAA0B,EAAE,GAAG,EAAE;YACpC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACjC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,iCAAiC,EAAE,GAAG,EAAE;YAC3C,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACd,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACd,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;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