data-structure-typed 1.51.6 → 1.51.8
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/CHANGELOG.md +1 -1
- package/README.md +13 -13
- package/benchmark/report.html +37 -1
- package/benchmark/report.json +405 -3
- package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.d.ts +3 -12
- package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js +2 -10
- package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +3 -3
- package/dist/cjs/data-structures/binary-tree/avl-tree.js +12 -14
- package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +7 -13
- package/dist/cjs/data-structures/binary-tree/binary-tree.js +46 -78
- package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/bst.d.ts +51 -96
- package/dist/cjs/data-structures/binary-tree/bst.js +120 -218
- package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/rb-tree.d.ts +3 -4
- package/dist/cjs/data-structures/binary-tree/rb-tree.js +4 -2
- package/dist/cjs/data-structures/binary-tree/rb-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/tree-multi-map.d.ts +3 -4
- package/dist/cjs/data-structures/binary-tree/tree-multi-map.js +1 -0
- package/dist/cjs/data-structures/binary-tree/tree-multi-map.js.map +1 -1
- package/dist/cjs/data-structures/heap/heap.d.ts +1 -3
- package/dist/cjs/data-structures/heap/heap.js.map +1 -1
- package/dist/cjs/interfaces/binary-tree.d.ts +3 -3
- package/dist/cjs/types/common.d.ts +1 -1
- package/dist/cjs/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +3 -2
- package/dist/cjs/types/data-structures/binary-tree/avl-tree.d.ts +3 -2
- package/dist/cjs/types/data-structures/binary-tree/binary-tree.d.ts +4 -4
- package/dist/cjs/types/data-structures/binary-tree/bst.d.ts +6 -5
- package/dist/cjs/types/data-structures/binary-tree/rb-tree.d.ts +4 -3
- package/dist/cjs/types/data-structures/binary-tree/tree-multi-map.d.ts +3 -2
- package/dist/cjs/types/utils/utils.d.ts +10 -1
- package/dist/cjs/utils/utils.d.ts +2 -1
- package/dist/cjs/utils/utils.js +29 -1
- package/dist/cjs/utils/utils.js.map +1 -1
- package/dist/mjs/data-structures/binary-tree/avl-tree-multi-map.d.ts +3 -12
- package/dist/mjs/data-structures/binary-tree/avl-tree-multi-map.js +2 -10
- package/dist/mjs/data-structures/binary-tree/avl-tree.d.ts +3 -3
- package/dist/mjs/data-structures/binary-tree/avl-tree.js +12 -14
- package/dist/mjs/data-structures/binary-tree/binary-tree.d.ts +7 -13
- package/dist/mjs/data-structures/binary-tree/binary-tree.js +45 -77
- package/dist/mjs/data-structures/binary-tree/bst.d.ts +51 -96
- package/dist/mjs/data-structures/binary-tree/bst.js +122 -221
- package/dist/mjs/data-structures/binary-tree/rb-tree.d.ts +3 -4
- package/dist/mjs/data-structures/binary-tree/rb-tree.js +4 -2
- package/dist/mjs/data-structures/binary-tree/tree-multi-map.d.ts +3 -4
- package/dist/mjs/data-structures/binary-tree/tree-multi-map.js +1 -0
- package/dist/mjs/data-structures/heap/heap.d.ts +1 -3
- package/dist/mjs/interfaces/binary-tree.d.ts +3 -3
- package/dist/mjs/types/common.d.ts +1 -1
- package/dist/mjs/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +3 -2
- package/dist/mjs/types/data-structures/binary-tree/avl-tree.d.ts +3 -2
- package/dist/mjs/types/data-structures/binary-tree/binary-tree.d.ts +4 -4
- package/dist/mjs/types/data-structures/binary-tree/bst.d.ts +6 -5
- package/dist/mjs/types/data-structures/binary-tree/rb-tree.d.ts +4 -3
- package/dist/mjs/types/data-structures/binary-tree/tree-multi-map.d.ts +3 -2
- package/dist/mjs/types/utils/utils.d.ts +10 -1
- package/dist/mjs/utils/utils.d.ts +2 -1
- package/dist/mjs/utils/utils.js +27 -0
- package/dist/umd/data-structure-typed.js +206 -301
- package/dist/umd/data-structure-typed.min.js +4 -4
- package/dist/umd/data-structure-typed.min.js.map +1 -1
- package/package.json +6 -6
- package/src/data-structures/binary-tree/avl-tree-multi-map.ts +5 -12
- package/src/data-structures/binary-tree/avl-tree.ts +15 -15
- package/src/data-structures/binary-tree/binary-tree.ts +56 -76
- package/src/data-structures/binary-tree/bst.ts +132 -224
- package/src/data-structures/binary-tree/rb-tree.ts +9 -6
- package/src/data-structures/binary-tree/tree-multi-map.ts +5 -3
- package/src/data-structures/heap/heap.ts +1 -1
- package/src/interfaces/binary-tree.ts +4 -3
- package/src/types/common.ts +1 -1
- package/src/types/data-structures/binary-tree/avl-tree-multi-map.ts +3 -2
- package/src/types/data-structures/binary-tree/avl-tree.ts +3 -2
- package/src/types/data-structures/binary-tree/binary-tree.ts +5 -5
- package/src/types/data-structures/binary-tree/bst.ts +6 -5
- package/src/types/data-structures/binary-tree/rb-tree.ts +4 -3
- package/src/types/data-structures/binary-tree/tree-multi-map.ts +3 -2
- package/src/types/utils/utils.ts +14 -1
- package/src/utils/utils.ts +20 -1
- package/test/integration/all-in-one.test.ts +2 -2
- package/test/integration/index.html +70 -0
- package/test/performance/data-structures/binary-tree/binary-tree-overall.test.ts +7 -7
- package/test/performance/reportor.ts +2 -3
- package/test/unit/data-structures/binary-tree/avl-tree-multi-map.test.ts +7 -7
- package/test/unit/data-structures/binary-tree/avl-tree.test.ts +2 -2
- package/test/unit/data-structures/binary-tree/bst.test.ts +6 -6
- package/test/unit/data-structures/binary-tree/overall.test.ts +24 -20
- package/test/unit/data-structures/binary-tree/tree-multi-map.test.ts +6 -6
- package/test/unit/utils/utils.test.ts +5 -0
- package/test/utils/console.ts +1 -1
|
@@ -59,25 +59,25 @@ export class BSTNode extends BinaryTreeNode {
|
|
|
59
59
|
*/
|
|
60
60
|
export class BST extends BinaryTree {
|
|
61
61
|
/**
|
|
62
|
-
* This is the constructor function for a
|
|
63
|
-
*
|
|
64
|
-
* @param keysOrNodesOrEntries -
|
|
65
|
-
* to initialize the binary search tree with the provided
|
|
62
|
+
* This is the constructor function for a Binary Search Tree class in TypeScript, which initializes
|
|
63
|
+
* the tree with keys, nodes, or entries and optional options.
|
|
64
|
+
* @param keysOrNodesOrEntries - The `keysOrNodesOrEntries` parameter is an iterable object that can
|
|
65
|
+
* contain keys, nodes, or entries. It is used to initialize the binary search tree with the provided
|
|
66
|
+
* keys, nodes, or entries.
|
|
66
67
|
* @param [options] - The `options` parameter is an optional object that can contain additional
|
|
67
68
|
* configuration options for the binary search tree. It can have the following properties:
|
|
68
69
|
*/
|
|
69
70
|
constructor(keysOrNodesOrEntries = [], options) {
|
|
70
71
|
super([], options);
|
|
71
72
|
if (options) {
|
|
72
|
-
const {
|
|
73
|
-
if (
|
|
74
|
-
this.
|
|
73
|
+
const { comparator } = options;
|
|
74
|
+
if (comparator)
|
|
75
|
+
this._comparator = comparator;
|
|
75
76
|
}
|
|
76
|
-
this._root = undefined;
|
|
77
77
|
if (keysOrNodesOrEntries)
|
|
78
78
|
this.addMany(keysOrNodesOrEntries);
|
|
79
79
|
}
|
|
80
|
-
_root;
|
|
80
|
+
_root = undefined;
|
|
81
81
|
/**
|
|
82
82
|
* The function returns the root node of a tree structure.
|
|
83
83
|
* @returns The `_root` property of the object, which is of type `NODE` or `undefined`.
|
|
@@ -85,13 +85,19 @@ export class BST extends BinaryTree {
|
|
|
85
85
|
get root() {
|
|
86
86
|
return this._root;
|
|
87
87
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
88
|
+
_comparator = (a, b) => {
|
|
89
|
+
if (a > b)
|
|
90
|
+
return 1;
|
|
91
|
+
if (a < b)
|
|
92
|
+
return -1;
|
|
93
|
+
return 0;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* The function returns the value of the _comparator property.
|
|
97
|
+
* @returns The `_comparator` property is being returned.
|
|
98
|
+
*/
|
|
99
|
+
get comparator() {
|
|
100
|
+
return this._comparator;
|
|
95
101
|
}
|
|
96
102
|
/**
|
|
97
103
|
* The function creates a new BSTNode with the given key and value and returns it.
|
|
@@ -115,7 +121,7 @@ export class BST extends BinaryTree {
|
|
|
115
121
|
createTree(options) {
|
|
116
122
|
return new BST([], {
|
|
117
123
|
iterationType: this.iterationType,
|
|
118
|
-
|
|
124
|
+
comparator: this.comparator,
|
|
119
125
|
...options
|
|
120
126
|
});
|
|
121
127
|
}
|
|
@@ -169,19 +175,21 @@ export class BST extends BinaryTree {
|
|
|
169
175
|
* @returns either a node object (NODE) or undefined.
|
|
170
176
|
*/
|
|
171
177
|
ensureNode(keyOrNodeOrEntry, iterationType = 'ITERATIVE') {
|
|
178
|
+
if (keyOrNodeOrEntry === this.NIL)
|
|
179
|
+
return;
|
|
172
180
|
if (this.isRealNode(keyOrNodeOrEntry)) {
|
|
173
181
|
return keyOrNodeOrEntry;
|
|
174
182
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
return this.getNodeByKey(keyOrNodeOrEntry[0], iterationType);
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
if (keyOrNodeOrEntry === null || keyOrNodeOrEntry === undefined)
|
|
183
|
+
if (this.isEntry(keyOrNodeOrEntry)) {
|
|
184
|
+
const key = keyOrNodeOrEntry[0];
|
|
185
|
+
if (key === null || key === undefined)
|
|
182
186
|
return;
|
|
183
|
-
return this.getNodeByKey(
|
|
187
|
+
return this.getNodeByKey(key, iterationType);
|
|
184
188
|
}
|
|
189
|
+
const key = keyOrNodeOrEntry;
|
|
190
|
+
if (key === null || key === undefined)
|
|
191
|
+
return;
|
|
192
|
+
return this.getNodeByKey(key, iterationType);
|
|
185
193
|
}
|
|
186
194
|
/**
|
|
187
195
|
* The function checks if an keyOrNodeOrEntry is an instance of BSTNode.
|
|
@@ -199,13 +207,11 @@ export class BST extends BinaryTree {
|
|
|
199
207
|
* Time Complexity: O(log n)
|
|
200
208
|
* Space Complexity: O(1)
|
|
201
209
|
*
|
|
202
|
-
* The `add` function adds a new node to a binary tree
|
|
203
|
-
*
|
|
204
|
-
* @param keyOrNodeOrEntry -
|
|
205
|
-
* @param {V} [value] - The
|
|
206
|
-
*
|
|
207
|
-
* @returns The method `add` returns either the newly added node (`newNode`) or `undefined` if the
|
|
208
|
-
* node was not added.
|
|
210
|
+
* The `add` function in TypeScript adds a new node to a binary search tree based on the key value,
|
|
211
|
+
* updating the value if the key already exists.
|
|
212
|
+
* @param keyOrNodeOrEntry - It is a parameter that can accept three types of values:
|
|
213
|
+
* @param {V} [value] - The value to be added to the binary search tree.
|
|
214
|
+
* @returns The method returns a boolean value.
|
|
209
215
|
*/
|
|
210
216
|
add(keyOrNodeOrEntry, value) {
|
|
211
217
|
const newNode = this.keyValueOrEntryToNode(keyOrNodeOrEntry, value);
|
|
@@ -218,7 +224,7 @@ export class BST extends BinaryTree {
|
|
|
218
224
|
}
|
|
219
225
|
let current = this.root;
|
|
220
226
|
while (current !== undefined) {
|
|
221
|
-
if (this.
|
|
227
|
+
if (this.comparator(current.key, newNode.key) === 0) {
|
|
222
228
|
// if (current !== newNode) {
|
|
223
229
|
// The key value is the same but the reference is different, update the value of the existing node
|
|
224
230
|
this._replaceNode(current, newNode);
|
|
@@ -229,7 +235,7 @@ export class BST extends BinaryTree {
|
|
|
229
235
|
// return;
|
|
230
236
|
// }
|
|
231
237
|
}
|
|
232
|
-
else if (this.
|
|
238
|
+
else if (this.comparator(current.key, newNode.key) > 0) {
|
|
233
239
|
if (current.left === undefined) {
|
|
234
240
|
current.left = newNode;
|
|
235
241
|
this._size++;
|
|
@@ -256,21 +262,24 @@ export class BST extends BinaryTree {
|
|
|
256
262
|
* Time Complexity: O(k log n)
|
|
257
263
|
* Space Complexity: O(k + log n)
|
|
258
264
|
*
|
|
259
|
-
* The `addMany` function in TypeScript adds multiple keys or nodes to a
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
*
|
|
265
|
+
* The `addMany` function in TypeScript adds multiple keys or nodes to a data structure, balancing
|
|
266
|
+
* the structure if specified, and returns an array indicating whether each key or node was
|
|
267
|
+
* successfully inserted.
|
|
268
|
+
* @param keysOrNodesOrEntries - An iterable containing keys, nodes, or entries to be added to the
|
|
269
|
+
* data structure.
|
|
263
270
|
* @param [values] - An optional iterable of values to be associated with the keys or nodes being
|
|
264
271
|
* added. If provided, the values will be assigned to the corresponding keys or nodes in the same
|
|
265
272
|
* order. If not provided, undefined will be assigned as the value for each key or node.
|
|
266
|
-
* @param [isBalanceAdd=true] - A boolean flag indicating whether the
|
|
267
|
-
*
|
|
268
|
-
* algorithm. If set to false, the
|
|
269
|
-
*
|
|
270
|
-
* @param iterationType - The `iterationType` parameter is an optional parameter that
|
|
271
|
-
* type of iteration to use when adding multiple keys or nodes
|
|
272
|
-
* `this.iterationType`, which
|
|
273
|
-
*
|
|
273
|
+
* @param [isBalanceAdd=true] - A boolean flag indicating whether the tree should be balanced after
|
|
274
|
+
* adding the elements. If set to true, the tree will be balanced using a binary search tree
|
|
275
|
+
* algorithm. If set to false, the elements will be added without balancing the tree. The default
|
|
276
|
+
* value is true.
|
|
277
|
+
* @param {IterationType} iterationType - The `iterationType` parameter is an optional parameter that
|
|
278
|
+
* specifies the type of iteration to use when adding multiple keys or nodes to the binary tree. It
|
|
279
|
+
* has a default value of `this.iterationType`, which means it will use the iteration type specified
|
|
280
|
+
* in the binary tree instance.
|
|
281
|
+
* @returns The function `addMany` returns an array of booleans indicating whether each key or node
|
|
282
|
+
* or entry was successfully inserted into the data structure.
|
|
274
283
|
*/
|
|
275
284
|
addMany(keysOrNodesOrEntries, values, isBalanceAdd = true, iterationType = this.iterationType) {
|
|
276
285
|
const inserted = [];
|
|
@@ -297,20 +306,24 @@ export class BST extends BinaryTree {
|
|
|
297
306
|
}
|
|
298
307
|
let sorted = [];
|
|
299
308
|
sorted = realBTNExemplars.sort((a, b) => {
|
|
300
|
-
let
|
|
301
|
-
if (this.isEntry(a))
|
|
302
|
-
|
|
309
|
+
let keyA, keyB;
|
|
310
|
+
if (this.isEntry(a)) {
|
|
311
|
+
keyA = a[0];
|
|
312
|
+
}
|
|
303
313
|
else if (this.isRealNode(a))
|
|
304
|
-
|
|
314
|
+
keyA = a.key;
|
|
305
315
|
else
|
|
306
|
-
|
|
316
|
+
keyA = a;
|
|
307
317
|
if (this.isEntry(b))
|
|
308
|
-
|
|
318
|
+
keyB = b[0];
|
|
309
319
|
else if (this.isRealNode(b))
|
|
310
|
-
|
|
320
|
+
keyB = b.key;
|
|
311
321
|
else
|
|
312
|
-
|
|
313
|
-
|
|
322
|
+
keyB = b;
|
|
323
|
+
if (keyA !== undefined && keyA !== null && keyB !== undefined && keyB !== null) {
|
|
324
|
+
return this.comparator(keyA, keyB);
|
|
325
|
+
}
|
|
326
|
+
return 0;
|
|
314
327
|
});
|
|
315
328
|
const _dfs = (arr) => {
|
|
316
329
|
if (arr.length === 0)
|
|
@@ -346,56 +359,6 @@ export class BST extends BinaryTree {
|
|
|
346
359
|
}
|
|
347
360
|
return inserted;
|
|
348
361
|
}
|
|
349
|
-
/**
|
|
350
|
-
* Time Complexity: O(log n)
|
|
351
|
-
* Space Complexity: O(1)
|
|
352
|
-
*/
|
|
353
|
-
/**
|
|
354
|
-
* Time Complexity: O(log n)
|
|
355
|
-
* Space Complexity: O(1)
|
|
356
|
-
*
|
|
357
|
-
* The function `getNodeByKey` searches for a node in a binary tree based on a given key, using
|
|
358
|
-
* either recursive or iterative methods.
|
|
359
|
-
* @param {K} key - The `key` parameter is the key value that we are searching for in the tree.
|
|
360
|
-
* It is used to identify the node that we want to retrieve.
|
|
361
|
-
* @param iterationType - The `iterationType` parameter is an optional parameter that specifies the
|
|
362
|
-
* type of iteration to use when searching for a node in the binary tree. It can have two possible
|
|
363
|
-
* values:
|
|
364
|
-
* @returns The function `getNodeByKey` returns a node (`NODE`) if a node with the specified key is
|
|
365
|
-
* found in the binary tree. If no node is found, it returns `undefined`.
|
|
366
|
-
*/
|
|
367
|
-
getNodeByKey(key, iterationType = 'ITERATIVE') {
|
|
368
|
-
// return this.getNodes(key, this._DEFAULT_CALLBACK, true, this.root, iterationType)[0];
|
|
369
|
-
if (!this.isRealNode(this.root))
|
|
370
|
-
return;
|
|
371
|
-
if (iterationType === 'RECURSIVE') {
|
|
372
|
-
const dfs = (cur) => {
|
|
373
|
-
if (cur.key === key)
|
|
374
|
-
return cur;
|
|
375
|
-
if (!this.isRealNode(cur.left) && !this.isRealNode(cur.right))
|
|
376
|
-
return;
|
|
377
|
-
if (this.isRealNode(cur.left) && this._compare(cur.key, key) === 'GT')
|
|
378
|
-
return dfs(cur.left);
|
|
379
|
-
if (this.isRealNode(cur.right) && this._compare(cur.key, key) === 'LT')
|
|
380
|
-
return dfs(cur.right);
|
|
381
|
-
};
|
|
382
|
-
return dfs(this.root);
|
|
383
|
-
}
|
|
384
|
-
else {
|
|
385
|
-
const stack = [this.root];
|
|
386
|
-
while (stack.length > 0) {
|
|
387
|
-
const cur = stack.pop();
|
|
388
|
-
if (this.isRealNode(cur)) {
|
|
389
|
-
if (this._compare(cur.key, key) === 'EQ')
|
|
390
|
-
return cur;
|
|
391
|
-
if (this.isRealNode(cur.left) && this._compare(cur.key, key) === 'GT')
|
|
392
|
-
stack.push(cur.left);
|
|
393
|
-
if (this.isRealNode(cur.right) && this._compare(cur.key, key) === 'LT')
|
|
394
|
-
stack.push(cur.right);
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
362
|
/**
|
|
400
363
|
* Time Complexity: O(log n)
|
|
401
364
|
* Space Complexity: O(k + log n)
|
|
@@ -428,6 +391,7 @@ export class BST extends BinaryTree {
|
|
|
428
391
|
beginRoot = this.ensureNode(beginRoot);
|
|
429
392
|
if (!beginRoot)
|
|
430
393
|
return [];
|
|
394
|
+
callback = this._ensureCallback(identifier, callback);
|
|
431
395
|
const ans = [];
|
|
432
396
|
if (iterationType === 'RECURSIVE') {
|
|
433
397
|
const dfs = (cur) => {
|
|
@@ -441,9 +405,9 @@ export class BST extends BinaryTree {
|
|
|
441
405
|
return;
|
|
442
406
|
// TODO potential bug
|
|
443
407
|
if (callback === this._DEFAULT_CALLBACK) {
|
|
444
|
-
if (this.isRealNode(cur.left) && this.
|
|
408
|
+
if (this.isRealNode(cur.left) && this.comparator(cur.key, identifier) > 0)
|
|
445
409
|
dfs(cur.left);
|
|
446
|
-
if (this.isRealNode(cur.right) && this.
|
|
410
|
+
if (this.isRealNode(cur.right) && this.comparator(cur.key, identifier) < 0)
|
|
447
411
|
dfs(cur.right);
|
|
448
412
|
}
|
|
449
413
|
else {
|
|
@@ -457,30 +421,28 @@ export class BST extends BinaryTree {
|
|
|
457
421
|
const stack = [beginRoot];
|
|
458
422
|
while (stack.length > 0) {
|
|
459
423
|
const cur = stack.pop();
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
if (
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
this.isRealNode(cur.left) && stack.push(cur.left);
|
|
483
|
-
}
|
|
424
|
+
const callbackResult = callback(cur);
|
|
425
|
+
if (callbackResult === identifier) {
|
|
426
|
+
ans.push(cur);
|
|
427
|
+
if (onlyOne)
|
|
428
|
+
return ans;
|
|
429
|
+
}
|
|
430
|
+
// TODO potential bug
|
|
431
|
+
if (callback === this._DEFAULT_CALLBACK) {
|
|
432
|
+
if (this.isRealNode(cur.right) && this.comparator(cur.key, identifier) < 0)
|
|
433
|
+
stack.push(cur.right);
|
|
434
|
+
if (this.isRealNode(cur.left) && this.comparator(cur.key, identifier) > 0)
|
|
435
|
+
stack.push(cur.left);
|
|
436
|
+
// if (this.isRealNode(cur.right) && this._lt(cur.key, identifier as K)) stack.push(cur.right);
|
|
437
|
+
// if (this.isRealNode(cur.left) && this._gt(cur.key, identifier as K)) stack.push(cur.left);
|
|
438
|
+
// // @ts-ignore
|
|
439
|
+
// if (this.isRealNode(cur.right) && cur.key > identifier) stack.push(cur.right);
|
|
440
|
+
// // @ts-ignore
|
|
441
|
+
// if (this.isRealNode(cur.left) && cur.key < identifier) stack.push(cur.left);
|
|
442
|
+
}
|
|
443
|
+
else {
|
|
444
|
+
this.isRealNode(cur.right) && stack.push(cur.right);
|
|
445
|
+
this.isRealNode(cur.left) && stack.push(cur.left);
|
|
484
446
|
}
|
|
485
447
|
}
|
|
486
448
|
}
|
|
@@ -514,6 +476,27 @@ export class BST extends BinaryTree {
|
|
|
514
476
|
getNode(identifier, callback = this._DEFAULT_CALLBACK, beginRoot = this.root, iterationType = this.iterationType) {
|
|
515
477
|
return this.getNodes(identifier, callback, true, beginRoot, iterationType)[0] ?? undefined;
|
|
516
478
|
}
|
|
479
|
+
/**
|
|
480
|
+
* Time Complexity: O(log n)
|
|
481
|
+
* Space Complexity: O(1)
|
|
482
|
+
*/
|
|
483
|
+
/**
|
|
484
|
+
* Time Complexity: O(log n)
|
|
485
|
+
* Space Complexity: O(1)
|
|
486
|
+
*
|
|
487
|
+
* The function `getNodeByKey` searches for a node in a binary tree based on a given key, using
|
|
488
|
+
* either recursive or iterative methods.
|
|
489
|
+
* @param {K} key - The `key` parameter is the key value that we are searching for in the tree.
|
|
490
|
+
* It is used to identify the node that we want to retrieve.
|
|
491
|
+
* @param iterationType - The `iterationType` parameter is an optional parameter that specifies the
|
|
492
|
+
* type of iteration to use when searching for a node in the binary tree. It can have two possible
|
|
493
|
+
* values:
|
|
494
|
+
* @returns The function `getNodeByKey` returns a node (`NODE`) if a node with the specified key is
|
|
495
|
+
* found in the binary tree. If no node is found, it returns `undefined`.
|
|
496
|
+
*/
|
|
497
|
+
getNodeByKey(key, iterationType = 'ITERATIVE') {
|
|
498
|
+
return this.getNode(key, this._DEFAULT_CALLBACK, this.root, iterationType);
|
|
499
|
+
}
|
|
517
500
|
/**
|
|
518
501
|
* Time complexity: O(n)
|
|
519
502
|
* Space complexity: O(n)
|
|
@@ -589,41 +572,6 @@ export class BST extends BinaryTree {
|
|
|
589
572
|
listLevels(callback = this._DEFAULT_CALLBACK, beginRoot = this.root, iterationType = this.iterationType) {
|
|
590
573
|
return super.listLevels(callback, beginRoot, iterationType, false);
|
|
591
574
|
}
|
|
592
|
-
/**
|
|
593
|
-
* Time Complexity: O(log n)
|
|
594
|
-
* Space Complexity: O(1)
|
|
595
|
-
*/
|
|
596
|
-
/**
|
|
597
|
-
* Time Complexity: O(log n)
|
|
598
|
-
* Space Complexity: O(1)
|
|
599
|
-
*
|
|
600
|
-
* The `lastKey` function returns the key of the rightmost node in a binary tree, or the key of the
|
|
601
|
-
* leftmost node if the comparison result is greater than.
|
|
602
|
-
* @param {K | NODE | undefined} beginRoot - The `beginRoot` parameter is optional and can be of
|
|
603
|
-
* type `K`, `NODE`, or `undefined`. It represents the starting point for finding the last key in
|
|
604
|
-
* the binary tree. If not provided, it defaults to the root of the binary tree (`this.root`).
|
|
605
|
-
* @returns the key of the rightmost node in the binary tree if the comparison result is less than,
|
|
606
|
-
* the key of the leftmost node if the comparison result is greater than, and the key of the
|
|
607
|
-
* rightmost node otherwise. If no node is found, it returns 0.
|
|
608
|
-
*/
|
|
609
|
-
lastKey(beginRoot = this.root) {
|
|
610
|
-
let current = this.ensureNode(beginRoot);
|
|
611
|
-
if (!current)
|
|
612
|
-
return undefined;
|
|
613
|
-
if (this._variant === 'STANDARD') {
|
|
614
|
-
// For 'STANDARD', find the rightmost node
|
|
615
|
-
while (current.right !== undefined) {
|
|
616
|
-
current = current.right;
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
else {
|
|
620
|
-
// For BSTVariant.MAX, find the leftmost node
|
|
621
|
-
while (current.left !== undefined) {
|
|
622
|
-
current = current.left;
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
return current.key;
|
|
626
|
-
}
|
|
627
575
|
/**
|
|
628
576
|
* Time Complexity: O(log n)
|
|
629
577
|
* Space Complexity: O(log n)
|
|
@@ -649,18 +597,18 @@ export class BST extends BinaryTree {
|
|
|
649
597
|
* @returns The function `lesserOrGreaterTraverse` returns an array of values of type
|
|
650
598
|
* `ReturnType<C>`, which is the return type of the callback function passed as an argument.
|
|
651
599
|
*/
|
|
652
|
-
lesserOrGreaterTraverse(callback = this._DEFAULT_CALLBACK, lesserOrGreater =
|
|
653
|
-
|
|
600
|
+
lesserOrGreaterTraverse(callback = this._DEFAULT_CALLBACK, lesserOrGreater = -1, targetNode = this.root, iterationType = this.iterationType) {
|
|
601
|
+
const targetNodeEnsured = this.ensureNode(targetNode);
|
|
654
602
|
const ans = [];
|
|
655
|
-
if (!
|
|
603
|
+
if (!targetNodeEnsured)
|
|
656
604
|
return ans;
|
|
657
605
|
if (!this.root)
|
|
658
606
|
return ans;
|
|
659
|
-
const targetKey =
|
|
607
|
+
const targetKey = targetNodeEnsured.key;
|
|
660
608
|
if (iterationType === 'RECURSIVE') {
|
|
661
609
|
const dfs = (cur) => {
|
|
662
|
-
const compared = this.
|
|
663
|
-
if (compared === lesserOrGreater)
|
|
610
|
+
const compared = this.comparator(cur.key, targetKey);
|
|
611
|
+
if (Math.sign(compared) === lesserOrGreater)
|
|
664
612
|
ans.push(callback(cur));
|
|
665
613
|
if (this.isRealNode(cur.left))
|
|
666
614
|
dfs(cur.left);
|
|
@@ -675,8 +623,8 @@ export class BST extends BinaryTree {
|
|
|
675
623
|
while (queue.size > 0) {
|
|
676
624
|
const cur = queue.shift();
|
|
677
625
|
if (this.isRealNode(cur)) {
|
|
678
|
-
const compared = this.
|
|
679
|
-
if (compared === lesserOrGreater)
|
|
626
|
+
const compared = this.comparator(cur.key, targetKey);
|
|
627
|
+
if (Math.sign(compared) === lesserOrGreater)
|
|
680
628
|
ans.push(callback(cur));
|
|
681
629
|
if (this.isRealNode(cur.left))
|
|
682
630
|
queue.push(cur.left);
|
|
@@ -816,51 +764,4 @@ export class BST extends BinaryTree {
|
|
|
816
764
|
}
|
|
817
765
|
this._root = v;
|
|
818
766
|
}
|
|
819
|
-
/**
|
|
820
|
-
* The function compares two values using a comparator function and returns whether the first value
|
|
821
|
-
* is greater than, less than, or equal to the second value.
|
|
822
|
-
* @param {K} a - The parameter "a" is of type K.
|
|
823
|
-
* @param {K} b - The parameter "b" in the above code represents a K.
|
|
824
|
-
* @returns a value of type CP (ComparisonResult). The possible return values are 'GT' (greater
|
|
825
|
-
* than), 'LT' (less than), or 'EQ' (equal).
|
|
826
|
-
*/
|
|
827
|
-
_compare(a, b) {
|
|
828
|
-
const extractedA = this.extractor(a);
|
|
829
|
-
const extractedB = this.extractor(b);
|
|
830
|
-
const compared = this.variant === 'STANDARD' ? extractedA - extractedB : extractedB - extractedA;
|
|
831
|
-
return compared > 0 ? 'GT' : compared < 0 ? 'LT' : 'EQ';
|
|
832
|
-
}
|
|
833
|
-
/**
|
|
834
|
-
* The function `_lt` compares two values `a` and `b` using an extractor function and returns true if
|
|
835
|
-
* `a` is less than `b` based on the specified variant.
|
|
836
|
-
* @param {K} a - The parameter "a" is of type "K", which means it can be any type. It represents the
|
|
837
|
-
* first value to be compared in the function.
|
|
838
|
-
* @param {K} b - The parameter `b` is of type `K`, which means it can be any type. It is used as one
|
|
839
|
-
* of the arguments for the comparison in the `_lt` function.
|
|
840
|
-
* @returns a boolean value.
|
|
841
|
-
*/
|
|
842
|
-
_lt(a, b) {
|
|
843
|
-
const extractedA = this.extractor(a);
|
|
844
|
-
const extractedB = this.extractor(b);
|
|
845
|
-
// return this.variant === BSTVariant.STANDARD ? extractedA < extractedB : extractedA > extractedB;
|
|
846
|
-
return this.variant === 'STANDARD' ? extractedA < extractedB : extractedA > extractedB;
|
|
847
|
-
// return extractedA < extractedB;
|
|
848
|
-
// return a < b;
|
|
849
|
-
}
|
|
850
|
-
/**
|
|
851
|
-
* The function compares two values using a custom extractor function and returns true if the first
|
|
852
|
-
* value is greater than the second value.
|
|
853
|
-
* @param {K} a - The parameter "a" is of type K, which means it can be any type.
|
|
854
|
-
* @param {K} b - The parameter "b" is of type K, which means it can be any type. It is used as one
|
|
855
|
-
* of the arguments for the comparison in the function.
|
|
856
|
-
* @returns a boolean value.
|
|
857
|
-
*/
|
|
858
|
-
_gt(a, b) {
|
|
859
|
-
const extractedA = this.extractor(a);
|
|
860
|
-
const extractedB = this.extractor(b);
|
|
861
|
-
// return this.variant === BSTVariant.STANDARD ? extractedA > extractedB : extractedA < extractedB;
|
|
862
|
-
return this.variant === 'STANDARD' ? extractedA > extractedB : extractedA < extractedB;
|
|
863
|
-
// return extractedA > extractedB;
|
|
864
|
-
// return a > b;
|
|
865
|
-
}
|
|
866
767
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { BinaryTreeDeleteResult, BTNCallback, KeyOrNodeOrEntry, RBTreeOptions, RedBlackTreeNested, RedBlackTreeNodeNested } from '../../types';
|
|
2
|
-
import { CRUD, RBTNColor } from '../../types';
|
|
1
|
+
import type { BinaryTreeDeleteResult, BTNCallback, Comparable, CRUD, KeyOrNodeOrEntry, RBTNColor, RBTreeOptions, RedBlackTreeNested, RedBlackTreeNodeNested } from '../../types';
|
|
3
2
|
import { BST, BSTNode } from './bst';
|
|
4
3
|
import { IBinaryTree } from '../../interfaces';
|
|
5
|
-
export declare class RedBlackTreeNode<K
|
|
4
|
+
export declare class RedBlackTreeNode<K extends Comparable, V = any, NODE extends RedBlackTreeNode<K, V, NODE> = RedBlackTreeNodeNested<K, V>> extends BSTNode<K, V, NODE> {
|
|
6
5
|
/**
|
|
7
6
|
* The constructor function initializes a Red-Black Tree Node with a key, an optional value, and a
|
|
8
7
|
* color.
|
|
@@ -27,7 +26,7 @@ export declare class RedBlackTreeNode<K = any, V = any, NODE extends RedBlackTre
|
|
|
27
26
|
*/
|
|
28
27
|
set color(value: RBTNColor);
|
|
29
28
|
}
|
|
30
|
-
export declare class RedBlackTree<K
|
|
29
|
+
export declare class RedBlackTree<K extends Comparable, V = any, NODE extends RedBlackTreeNode<K, V, NODE> = RedBlackTreeNode<K, V, RedBlackTreeNodeNested<K, V>>, TREE extends RedBlackTree<K, V, NODE, TREE> = RedBlackTree<K, V, NODE, RedBlackTreeNested<K, V, NODE>>> extends BST<K, V, NODE, TREE> implements IBinaryTree<K, V, NODE, TREE> {
|
|
31
30
|
/**
|
|
32
31
|
* This is the constructor function for a Red-Black Tree data structure in TypeScript.
|
|
33
32
|
* @param keysOrNodesOrEntries - The `keysOrNodesOrEntries` parameter is an iterable object that can
|
|
@@ -215,6 +215,7 @@ export class RedBlackTree extends BST {
|
|
|
215
215
|
if (identifier === null)
|
|
216
216
|
return [];
|
|
217
217
|
const results = [];
|
|
218
|
+
callback = this._ensureCallback(identifier, callback);
|
|
218
219
|
const nodeToDelete = this.isRealNode(identifier) ? identifier : this.getNode(identifier, callback);
|
|
219
220
|
if (!nodeToDelete) {
|
|
220
221
|
return results;
|
|
@@ -313,10 +314,11 @@ export class RedBlackTree extends BST {
|
|
|
313
314
|
let parent = undefined;
|
|
314
315
|
while (this.isRealNode(current)) {
|
|
315
316
|
parent = current;
|
|
316
|
-
|
|
317
|
+
const compared = this.comparator(node.key, current.key);
|
|
318
|
+
if (compared < 0) {
|
|
317
319
|
current = current.left ?? this.NIL;
|
|
318
320
|
}
|
|
319
|
-
else if (
|
|
321
|
+
else if (compared > 0) {
|
|
320
322
|
current = current.right ?? this.NIL;
|
|
321
323
|
}
|
|
322
324
|
else {
|
|
@@ -5,11 +5,10 @@
|
|
|
5
5
|
* @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
|
-
import type { BinaryTreeDeleteResult, BSTNKeyOrNode, BTNCallback, IterationType, KeyOrNodeOrEntry, TreeMultiMapNested, TreeMultiMapNodeNested, TreeMultiMapOptions } from '../../types';
|
|
9
|
-
import { RBTNColor } from '../../types';
|
|
8
|
+
import type { BinaryTreeDeleteResult, BSTNKeyOrNode, BTNCallback, Comparable, IterationType, KeyOrNodeOrEntry, RBTNColor, TreeMultiMapNested, TreeMultiMapNodeNested, TreeMultiMapOptions } from '../../types';
|
|
10
9
|
import { IBinaryTree } from '../../interfaces';
|
|
11
10
|
import { RedBlackTree, RedBlackTreeNode } from './rb-tree';
|
|
12
|
-
export declare class TreeMultiMapNode<K
|
|
11
|
+
export declare class TreeMultiMapNode<K extends Comparable, V = any, NODE extends TreeMultiMapNode<K, V, NODE> = TreeMultiMapNodeNested<K, V>> extends RedBlackTreeNode<K, V, NODE> {
|
|
13
12
|
/**
|
|
14
13
|
* The constructor function initializes a Red-Black Tree node with a key, value, count, and color.
|
|
15
14
|
* @param {K} key - The key parameter represents the key of the node in the Red-Black Tree. It is
|
|
@@ -36,7 +35,7 @@ export declare class TreeMultiMapNode<K = any, V = any, NODE extends TreeMultiMa
|
|
|
36
35
|
*/
|
|
37
36
|
set count(value: number);
|
|
38
37
|
}
|
|
39
|
-
export declare class TreeMultiMap<K
|
|
38
|
+
export declare class TreeMultiMap<K extends Comparable, V = any, NODE extends TreeMultiMapNode<K, V, NODE> = TreeMultiMapNode<K, V, TreeMultiMapNodeNested<K, V>>, TREE extends TreeMultiMap<K, V, NODE, TREE> = TreeMultiMap<K, V, NODE, TreeMultiMapNested<K, V, NODE>>> extends RedBlackTree<K, V, NODE, TREE> implements IBinaryTree<K, V, NODE, TREE> {
|
|
40
39
|
/**
|
|
41
40
|
* The constructor function initializes a new instance of the TreeMultiMap class with optional
|
|
42
41
|
* initial keys, nodes, or entries.
|
|
@@ -209,6 +209,7 @@ export class TreeMultiMap extends RedBlackTree {
|
|
|
209
209
|
if (identifier === null)
|
|
210
210
|
return [];
|
|
211
211
|
const results = [];
|
|
212
|
+
callback = this._ensureCallback(identifier, callback);
|
|
212
213
|
const nodeToDelete = this.isRealNode(identifier) ? identifier : this.getNode(identifier, callback);
|
|
213
214
|
if (!nodeToDelete) {
|
|
214
215
|
return results;
|
|
@@ -57,9 +57,7 @@ export declare class Heap<E = any> extends IterableElementBase<E> {
|
|
|
57
57
|
* @param elements
|
|
58
58
|
* @param options
|
|
59
59
|
*/
|
|
60
|
-
static heapify<E>(elements: Iterable<E>, options:
|
|
61
|
-
comparator: Comparator<E>;
|
|
62
|
-
}): Heap<E>;
|
|
60
|
+
static heapify<E>(elements: Iterable<E>, options: HeapOptions<E>): Heap<E>;
|
|
63
61
|
/**
|
|
64
62
|
* Time Complexity: O(log n)
|
|
65
63
|
* Space Complexity: O(1)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BinaryTree, BinaryTreeNode } from '../data-structures';
|
|
2
|
-
import { BinaryTreeDeleteResult, BinaryTreeNested, BinaryTreeNodeNested, BinaryTreeOptions, BTNCallback, KeyOrNodeOrEntry } from '../types';
|
|
3
|
-
export interface IBinaryTree<K
|
|
2
|
+
import type { BinaryTreeDeleteResult, BinaryTreeNested, BinaryTreeNodeNested, BinaryTreeOptions, BTNCallback, Comparable, KeyOrNodeOrEntry } from '../types';
|
|
3
|
+
export interface IBinaryTree<K extends Comparable, V = any, N extends BinaryTreeNode<K, V, N> = BinaryTreeNodeNested<K, V>, TREE extends BinaryTree<K, V, N, TREE> = BinaryTreeNested<K, V, N>> {
|
|
4
4
|
createNode(key: K, value?: N['value']): N;
|
|
5
|
-
createTree(options?: Partial<BinaryTreeOptions
|
|
5
|
+
createTree(options?: Partial<BinaryTreeOptions>): TREE;
|
|
6
6
|
add(keyOrNodeOrEntry: KeyOrNodeOrEntry<K, V, N>, value?: V, count?: number): boolean;
|
|
7
7
|
addMany(nodes: Iterable<KeyOrNodeOrEntry<K, V, N>>, values?: Iterable<V | undefined>): boolean[];
|
|
8
8
|
delete<C extends BTNCallback<N>>(identifier: ReturnType<C> | null, callback: C): BinaryTreeDeleteResult<N>[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AVLTreeMultiMap, AVLTreeMultiMapNode } from '../../../data-structures';
|
|
2
2
|
import type { AVLTreeOptions } from './avl-tree';
|
|
3
|
-
|
|
4
|
-
export type
|
|
3
|
+
import { Comparable } from "../../utils";
|
|
4
|
+
export type AVLTreeMultiMapNodeNested<K extends Comparable, V> = AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
|
|
5
|
+
export type AVLTreeMultiMapNested<K extends Comparable, V, N extends AVLTreeMultiMapNode<K, V, N>> = AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
|
|
5
6
|
export type AVLTreeMultiMapOptions<K> = AVLTreeOptions<K> & {};
|