data-structure-typed 1.51.7 → 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.
Files changed (89) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/README.md +13 -13
  3. package/benchmark/report.html +13 -13
  4. package/benchmark/report.json +156 -156
  5. package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.d.ts +3 -12
  6. package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js +1 -10
  7. package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js.map +1 -1
  8. package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +3 -3
  9. package/dist/cjs/data-structures/binary-tree/avl-tree.js +12 -12
  10. package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -1
  11. package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +5 -12
  12. package/dist/cjs/data-structures/binary-tree/binary-tree.js +22 -32
  13. package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
  14. package/dist/cjs/data-structures/binary-tree/bst.d.ts +32 -77
  15. package/dist/cjs/data-structures/binary-tree/bst.js +68 -136
  16. package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
  17. package/dist/cjs/data-structures/binary-tree/rb-tree.d.ts +3 -13
  18. package/dist/cjs/data-structures/binary-tree/rb-tree.js +3 -20
  19. package/dist/cjs/data-structures/binary-tree/rb-tree.js.map +1 -1
  20. package/dist/cjs/data-structures/binary-tree/tree-multi-map.d.ts +3 -4
  21. package/dist/cjs/data-structures/binary-tree/tree-multi-map.js.map +1 -1
  22. package/dist/cjs/data-structures/heap/heap.d.ts +1 -3
  23. package/dist/cjs/data-structures/heap/heap.js.map +1 -1
  24. package/dist/cjs/interfaces/binary-tree.d.ts +3 -3
  25. package/dist/cjs/types/common.d.ts +1 -1
  26. package/dist/cjs/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +3 -2
  27. package/dist/cjs/types/data-structures/binary-tree/avl-tree.d.ts +3 -2
  28. package/dist/cjs/types/data-structures/binary-tree/binary-tree.d.ts +4 -4
  29. package/dist/cjs/types/data-structures/binary-tree/bst.d.ts +6 -5
  30. package/dist/cjs/types/data-structures/binary-tree/rb-tree.d.ts +4 -3
  31. package/dist/cjs/types/data-structures/binary-tree/tree-multi-map.d.ts +3 -2
  32. package/dist/cjs/types/utils/utils.d.ts +10 -1
  33. package/dist/cjs/utils/utils.d.ts +2 -1
  34. package/dist/cjs/utils/utils.js +29 -1
  35. package/dist/cjs/utils/utils.js.map +1 -1
  36. package/dist/mjs/data-structures/binary-tree/avl-tree-multi-map.d.ts +3 -12
  37. package/dist/mjs/data-structures/binary-tree/avl-tree-multi-map.js +1 -10
  38. package/dist/mjs/data-structures/binary-tree/avl-tree.d.ts +3 -3
  39. package/dist/mjs/data-structures/binary-tree/avl-tree.js +12 -12
  40. package/dist/mjs/data-structures/binary-tree/binary-tree.d.ts +5 -12
  41. package/dist/mjs/data-structures/binary-tree/binary-tree.js +22 -32
  42. package/dist/mjs/data-structures/binary-tree/bst.d.ts +32 -77
  43. package/dist/mjs/data-structures/binary-tree/bst.js +70 -139
  44. package/dist/mjs/data-structures/binary-tree/rb-tree.d.ts +3 -13
  45. package/dist/mjs/data-structures/binary-tree/rb-tree.js +3 -20
  46. package/dist/mjs/data-structures/binary-tree/tree-multi-map.d.ts +3 -4
  47. package/dist/mjs/data-structures/heap/heap.d.ts +1 -3
  48. package/dist/mjs/interfaces/binary-tree.d.ts +3 -3
  49. package/dist/mjs/types/common.d.ts +1 -1
  50. package/dist/mjs/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +3 -2
  51. package/dist/mjs/types/data-structures/binary-tree/avl-tree.d.ts +3 -2
  52. package/dist/mjs/types/data-structures/binary-tree/binary-tree.d.ts +4 -4
  53. package/dist/mjs/types/data-structures/binary-tree/bst.d.ts +6 -5
  54. package/dist/mjs/types/data-structures/binary-tree/rb-tree.d.ts +4 -3
  55. package/dist/mjs/types/data-structures/binary-tree/tree-multi-map.d.ts +3 -2
  56. package/dist/mjs/types/utils/utils.d.ts +10 -1
  57. package/dist/mjs/utils/utils.d.ts +2 -1
  58. package/dist/mjs/utils/utils.js +27 -0
  59. package/dist/umd/data-structure-typed.js +133 -208
  60. package/dist/umd/data-structure-typed.min.js +4 -4
  61. package/dist/umd/data-structure-typed.min.js.map +1 -1
  62. package/package.json +6 -6
  63. package/src/data-structures/binary-tree/avl-tree-multi-map.ts +4 -12
  64. package/src/data-structures/binary-tree/avl-tree.ts +15 -14
  65. package/src/data-structures/binary-tree/binary-tree.ts +29 -38
  66. package/src/data-structures/binary-tree/bst.ts +78 -148
  67. package/src/data-structures/binary-tree/rb-tree.ts +8 -22
  68. package/src/data-structures/binary-tree/tree-multi-map.ts +4 -3
  69. package/src/data-structures/heap/heap.ts +1 -1
  70. package/src/interfaces/binary-tree.ts +4 -3
  71. package/src/types/common.ts +1 -1
  72. package/src/types/data-structures/binary-tree/avl-tree-multi-map.ts +3 -2
  73. package/src/types/data-structures/binary-tree/avl-tree.ts +3 -2
  74. package/src/types/data-structures/binary-tree/binary-tree.ts +5 -5
  75. package/src/types/data-structures/binary-tree/bst.ts +6 -5
  76. package/src/types/data-structures/binary-tree/rb-tree.ts +4 -3
  77. package/src/types/data-structures/binary-tree/tree-multi-map.ts +3 -2
  78. package/src/types/utils/utils.ts +14 -1
  79. package/src/utils/utils.ts +20 -1
  80. package/test/integration/all-in-one.test.ts +2 -2
  81. package/test/integration/index.html +70 -0
  82. package/test/performance/reportor.ts +2 -3
  83. package/test/unit/data-structures/binary-tree/avl-tree-multi-map.test.ts +7 -7
  84. package/test/unit/data-structures/binary-tree/avl-tree.test.ts +2 -2
  85. package/test/unit/data-structures/binary-tree/bst.test.ts +6 -6
  86. package/test/unit/data-structures/binary-tree/overall.test.ts +24 -20
  87. package/test/unit/data-structures/binary-tree/tree-multi-map.test.ts +6 -6
  88. package/test/unit/utils/utils.test.ts +5 -0
  89. 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 TypeScript class that initializes a binary search tree with
63
- * optional keys or nodes or entries and options.
64
- * @param keysOrNodesOrEntries - An iterable object that contains keys, nodes, or entries. It is used
65
- * to initialize the binary search tree with the provided keys, nodes, or entries.
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 { variant } = options;
73
- if (variant)
74
- this._variant = variant;
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
- _variant = 'STANDARD';
89
- /**
90
- * The function returns the value of the _variant property.
91
- * @returns The value of the `_variant` property.
92
- */
93
- get variant() {
94
- return this._variant;
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
- variant: this.variant,
124
+ comparator: this.comparator,
119
125
  ...options
120
126
  });
121
127
  }
@@ -201,13 +207,11 @@ export class BST extends BinaryTree {
201
207
  * Time Complexity: O(log n)
202
208
  * Space Complexity: O(1)
203
209
  *
204
- * The `add` function adds a new node to a binary tree, updating the value if the key already exists
205
- * or inserting a new node if the key is unique.
206
- * @param keyOrNodeOrEntry - The `keyOrNodeOrEntry` parameter can accept three types of values:
207
- * @param {V} [value] - The `value` parameter represents the value associated with the key that is
208
- * being added to the binary tree.
209
- * @returns The method `add` returns either the newly added node (`newNode`) or `undefined` if the
210
- * 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.
211
215
  */
212
216
  add(keyOrNodeOrEntry, value) {
213
217
  const newNode = this.keyValueOrEntryToNode(keyOrNodeOrEntry, value);
@@ -220,7 +224,7 @@ export class BST extends BinaryTree {
220
224
  }
221
225
  let current = this.root;
222
226
  while (current !== undefined) {
223
- if (this._compare(current.key, newNode.key) === 'EQ') {
227
+ if (this.comparator(current.key, newNode.key) === 0) {
224
228
  // if (current !== newNode) {
225
229
  // The key value is the same but the reference is different, update the value of the existing node
226
230
  this._replaceNode(current, newNode);
@@ -231,7 +235,7 @@ export class BST extends BinaryTree {
231
235
  // return;
232
236
  // }
233
237
  }
234
- else if (this._compare(current.key, newNode.key) === 'GT') {
238
+ else if (this.comparator(current.key, newNode.key) > 0) {
235
239
  if (current.left === undefined) {
236
240
  current.left = newNode;
237
241
  this._size++;
@@ -258,21 +262,24 @@ export class BST extends BinaryTree {
258
262
  * Time Complexity: O(k log n)
259
263
  * Space Complexity: O(k + log n)
260
264
  *
261
- * The `addMany` function in TypeScript adds multiple keys or nodes to a binary tree, optionally
262
- * balancing the tree after each addition.
263
- * @param keysOrNodesOrEntries - An iterable containing the keys, nodes, or entries to be added to
264
- * the binary tree.
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.
265
270
  * @param [values] - An optional iterable of values to be associated with the keys or nodes being
266
271
  * added. If provided, the values will be assigned to the corresponding keys or nodes in the same
267
272
  * order. If not provided, undefined will be assigned as the value for each key or node.
268
- * @param [isBalanceAdd=true] - A boolean flag indicating whether the add operation should be
269
- * balanced or not. If set to true, the add operation will be balanced using a binary search tree
270
- * algorithm. If set to false, the add operation will not be balanced and the nodes will be added
271
- * in the order they appear in the input.
272
- * @param iterationType - The `iterationType` parameter is an optional parameter that specifies the
273
- * type of iteration to use when adding multiple keys or nodes. It has a default value of
274
- * `this.iterationType`, which suggests that it is a property of the current object.
275
- * @returns The function `addMany` returns an array of nodes (`NODE`) or `undefined` values.
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.
276
283
  */
277
284
  addMany(keysOrNodesOrEntries, values, isBalanceAdd = true, iterationType = this.iterationType) {
278
285
  const inserted = [];
@@ -299,20 +306,24 @@ export class BST extends BinaryTree {
299
306
  }
300
307
  let sorted = [];
301
308
  sorted = realBTNExemplars.sort((a, b) => {
302
- let aR, bR;
303
- if (this.isEntry(a))
304
- aR = this.extractor(a[0]);
309
+ let keyA, keyB;
310
+ if (this.isEntry(a)) {
311
+ keyA = a[0];
312
+ }
305
313
  else if (this.isRealNode(a))
306
- aR = this.extractor(a.key);
314
+ keyA = a.key;
307
315
  else
308
- aR = this.extractor(a);
316
+ keyA = a;
309
317
  if (this.isEntry(b))
310
- bR = this.extractor(b[0]);
318
+ keyB = b[0];
311
319
  else if (this.isRealNode(b))
312
- bR = this.extractor(b.key);
320
+ keyB = b.key;
313
321
  else
314
- bR = this.extractor(b);
315
- return aR - bR;
322
+ keyB = b;
323
+ if (keyA !== undefined && keyA !== null && keyB !== undefined && keyB !== null) {
324
+ return this.comparator(keyA, keyB);
325
+ }
326
+ return 0;
316
327
  });
317
328
  const _dfs = (arr) => {
318
329
  if (arr.length === 0)
@@ -394,9 +405,9 @@ export class BST extends BinaryTree {
394
405
  return;
395
406
  // TODO potential bug
396
407
  if (callback === this._DEFAULT_CALLBACK) {
397
- if (this.isRealNode(cur.left) && this._compare(cur.key, identifier) === 'GT')
408
+ if (this.isRealNode(cur.left) && this.comparator(cur.key, identifier) > 0)
398
409
  dfs(cur.left);
399
- if (this.isRealNode(cur.right) && this._compare(cur.key, identifier) === 'LT')
410
+ if (this.isRealNode(cur.right) && this.comparator(cur.key, identifier) < 0)
400
411
  dfs(cur.right);
401
412
  }
402
413
  else {
@@ -418,9 +429,9 @@ export class BST extends BinaryTree {
418
429
  }
419
430
  // TODO potential bug
420
431
  if (callback === this._DEFAULT_CALLBACK) {
421
- if (this.isRealNode(cur.right) && this._compare(cur.key, identifier) === 'LT')
432
+ if (this.isRealNode(cur.right) && this.comparator(cur.key, identifier) < 0)
422
433
  stack.push(cur.right);
423
- if (this.isRealNode(cur.left) && this._compare(cur.key, identifier) === 'GT')
434
+ if (this.isRealNode(cur.left) && this.comparator(cur.key, identifier) > 0)
424
435
  stack.push(cur.left);
425
436
  // if (this.isRealNode(cur.right) && this._lt(cur.key, identifier as K)) stack.push(cur.right);
426
437
  // if (this.isRealNode(cur.left) && this._gt(cur.key, identifier as K)) stack.push(cur.left);
@@ -561,41 +572,6 @@ export class BST extends BinaryTree {
561
572
  listLevels(callback = this._DEFAULT_CALLBACK, beginRoot = this.root, iterationType = this.iterationType) {
562
573
  return super.listLevels(callback, beginRoot, iterationType, false);
563
574
  }
564
- /**
565
- * Time Complexity: O(log n)
566
- * Space Complexity: O(1)
567
- */
568
- /**
569
- * Time Complexity: O(log n)
570
- * Space Complexity: O(1)
571
- *
572
- * The `lastKey` function returns the key of the rightmost node in a binary tree, or the key of the
573
- * leftmost node if the comparison result is greater than.
574
- * @param {K | NODE | undefined} beginRoot - The `beginRoot` parameter is optional and can be of
575
- * type `K`, `NODE`, or `undefined`. It represents the starting point for finding the last key in
576
- * the binary tree. If not provided, it defaults to the root of the binary tree (`this.root`).
577
- * @returns the key of the rightmost node in the binary tree if the comparison result is less than,
578
- * the key of the leftmost node if the comparison result is greater than, and the key of the
579
- * rightmost node otherwise. If no node is found, it returns 0.
580
- */
581
- lastKey(beginRoot = this.root) {
582
- let current = this.ensureNode(beginRoot);
583
- if (!current)
584
- return undefined;
585
- if (this._variant === 'STANDARD') {
586
- // For 'STANDARD', find the rightmost node
587
- while (current.right !== undefined) {
588
- current = current.right;
589
- }
590
- }
591
- else {
592
- // For BSTVariant.MAX, find the leftmost node
593
- while (current.left !== undefined) {
594
- current = current.left;
595
- }
596
- }
597
- return current.key;
598
- }
599
575
  /**
600
576
  * Time Complexity: O(log n)
601
577
  * Space Complexity: O(log n)
@@ -621,18 +597,18 @@ export class BST extends BinaryTree {
621
597
  * @returns The function `lesserOrGreaterTraverse` returns an array of values of type
622
598
  * `ReturnType<C>`, which is the return type of the callback function passed as an argument.
623
599
  */
624
- lesserOrGreaterTraverse(callback = this._DEFAULT_CALLBACK, lesserOrGreater = 'LT', targetNode = this.root, iterationType = this.iterationType) {
625
- targetNode = this.ensureNode(targetNode);
600
+ lesserOrGreaterTraverse(callback = this._DEFAULT_CALLBACK, lesserOrGreater = -1, targetNode = this.root, iterationType = this.iterationType) {
601
+ const targetNodeEnsured = this.ensureNode(targetNode);
626
602
  const ans = [];
627
- if (!targetNode)
603
+ if (!targetNodeEnsured)
628
604
  return ans;
629
605
  if (!this.root)
630
606
  return ans;
631
- const targetKey = targetNode.key;
607
+ const targetKey = targetNodeEnsured.key;
632
608
  if (iterationType === 'RECURSIVE') {
633
609
  const dfs = (cur) => {
634
- const compared = this._compare(cur.key, targetKey);
635
- if (compared === lesserOrGreater)
610
+ const compared = this.comparator(cur.key, targetKey);
611
+ if (Math.sign(compared) === lesserOrGreater)
636
612
  ans.push(callback(cur));
637
613
  if (this.isRealNode(cur.left))
638
614
  dfs(cur.left);
@@ -647,8 +623,8 @@ export class BST extends BinaryTree {
647
623
  while (queue.size > 0) {
648
624
  const cur = queue.shift();
649
625
  if (this.isRealNode(cur)) {
650
- const compared = this._compare(cur.key, targetKey);
651
- if (compared === lesserOrGreater)
626
+ const compared = this.comparator(cur.key, targetKey);
627
+ if (Math.sign(compared) === lesserOrGreater)
652
628
  ans.push(callback(cur));
653
629
  if (this.isRealNode(cur.left))
654
630
  queue.push(cur.left);
@@ -788,49 +764,4 @@ export class BST extends BinaryTree {
788
764
  }
789
765
  this._root = v;
790
766
  }
791
- /**
792
- * The function compares two values using a comparator function and returns whether the first value
793
- * is greater than, less than, or equal to the second value.
794
- * @param {K} a - The parameter "a" is of type K.
795
- * @param {K} b - The parameter "b" in the above code represents a K.
796
- * @returns a value of type CP (ComparisonResult). The possible return values are 'GT' (greater
797
- * than), 'LT' (less than), or 'EQ' (equal).
798
- */
799
- _compare(a, b) {
800
- const extractedA = this.extractor(a);
801
- const extractedB = this.extractor(b);
802
- const compared = this.variant === 'STANDARD' ? extractedA - extractedB : extractedB - extractedA;
803
- if (compared > 0)
804
- return 'GT';
805
- if (compared < 0)
806
- return 'LT';
807
- return 'EQ';
808
- }
809
- /**
810
- * The function `_lt` compares two values `a` and `b` using an extractor function and returns true if
811
- * `a` is less than `b` based on the specified variant.
812
- * @param {K} a - The parameter "a" is of type "K", which means it can be any type. It represents the
813
- * first value to be compared in the function.
814
- * @param {K} b - The parameter `b` is of type `K`, which means it can be any type. It is used as one
815
- * of the arguments for the comparison in the `_lt` function.
816
- * @returns a boolean value.
817
- */
818
- _lt(a, b) {
819
- const extractedA = this.extractor(a);
820
- const extractedB = this.extractor(b);
821
- return this.variant === 'STANDARD' ? extractedA < extractedB : extractedA > extractedB;
822
- }
823
- /**
824
- * The function compares two values using a custom extractor function and returns true if the first
825
- * value is greater than the second value.
826
- * @param {K} a - The parameter "a" is of type K, which means it can be any type.
827
- * @param {K} b - The parameter "b" is of type K, which means it can be any type. It is used as one
828
- * of the arguments for the comparison in the function.
829
- * @returns a boolean value.
830
- */
831
- _gt(a, b) {
832
- const extractedA = this.extractor(a);
833
- const extractedB = this.extractor(b);
834
- return this.variant === 'STANDARD' ? extractedA > extractedB : extractedA < extractedB;
835
- }
836
767
  }
@@ -1,8 +1,7 @@
1
- import type { BinaryTreeDeleteResult, BTNCallback, KeyOrNodeOrEntry, RBTreeOptions, RedBlackTreeNested, RedBlackTreeNodeNested } from '../../types';
2
- import { CP, 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 = any, V = any, NODE extends RedBlackTreeNode<K, V, NODE> = RedBlackTreeNodeNested<K, V>> extends BSTNode<K, V, NODE> {
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 = any, 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> {
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
@@ -255,13 +254,4 @@ export declare class RedBlackTree<K = any, V = any, NODE extends RedBlackTreeNod
255
254
  * @returns void, which means it does not return any value.
256
255
  */
257
256
  protected _rightRotate(y: NODE | undefined): void;
258
- /**
259
- * The function compares two values using a comparator function and returns whether the first value
260
- * is greater than, less than, or equal to the second value.
261
- * @param {K} a - The parameter "a" is of type K.
262
- * @param {K} b - The parameter "b" in the above code represents a K.
263
- * @returns a value of type CP (ComparisonResult). The possible return values are 'GT' (greater
264
- * than), 'LT' (less than), or 'EQ' (equal).
265
- */
266
- protected _compare(a: K, b: K): CP;
267
257
  }
@@ -314,10 +314,11 @@ export class RedBlackTree extends BST {
314
314
  let parent = undefined;
315
315
  while (this.isRealNode(current)) {
316
316
  parent = current;
317
- if (node.key < current.key) {
317
+ const compared = this.comparator(node.key, current.key);
318
+ if (compared < 0) {
318
319
  current = current.left ?? this.NIL;
319
320
  }
320
- else if (node.key > current.key) {
321
+ else if (compared > 0) {
321
322
  current = current.right ?? this.NIL;
322
323
  }
323
324
  else {
@@ -597,22 +598,4 @@ export class RedBlackTree extends BST {
597
598
  x.right = y;
598
599
  y.parent = x;
599
600
  }
600
- /**
601
- * The function compares two values using a comparator function and returns whether the first value
602
- * is greater than, less than, or equal to the second value.
603
- * @param {K} a - The parameter "a" is of type K.
604
- * @param {K} b - The parameter "b" in the above code represents a K.
605
- * @returns a value of type CP (ComparisonResult). The possible return values are 'GT' (greater
606
- * than), 'LT' (less than), or 'EQ' (equal).
607
- */
608
- _compare(a, b) {
609
- const extractedA = this.extractor(a);
610
- const extractedB = this.extractor(b);
611
- const compared = extractedA - extractedB;
612
- if (compared > 0)
613
- return 'GT';
614
- if (compared < 0)
615
- return 'LT';
616
- return 'EQ';
617
- }
618
601
  }
@@ -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 = any, V = any, NODE extends TreeMultiMapNode<K, V, NODE> = TreeMultiMapNodeNested<K, V>> extends RedBlackTreeNode<K, V, NODE> {
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 = any, 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> {
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.
@@ -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 = number, V = any, N extends BinaryTreeNode<K, V, N> = BinaryTreeNodeNested<K, V>, TREE extends BinaryTree<K, V, N, TREE> = BinaryTreeNested<K, V, N>> {
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<K>>): TREE;
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,5 @@
1
1
  export type BSTVariant = 'STANDARD' | 'INVERSE';
2
- export type CP = 'LT' | 'EQ' | 'GT';
2
+ export type CP = 1 | -1 | 0;
3
3
  /**
4
4
  * Enum representing different loop types.
5
5
  *
@@ -1,5 +1,6 @@
1
1
  import { AVLTreeMultiMap, AVLTreeMultiMapNode } from '../../../data-structures';
2
2
  import type { AVLTreeOptions } from './avl-tree';
3
- export type AVLTreeMultiMapNodeNested<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, AVLTreeMultiMapNode<K, V, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
4
- export type AVLTreeMultiMapNested<K, 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>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
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> & {};
@@ -1,5 +1,6 @@
1
1
  import { AVLTree, AVLTreeNode } from '../../../data-structures';
2
2
  import { BSTOptions } from './bst';
3
- export type AVLTreeNodeNested<K, V> = AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
4
- export type AVLTreeNested<K, V, N extends AVLTreeNode<K, V, N>> = AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
3
+ import { Comparable } from "../../utils";
4
+ export type AVLTreeNodeNested<K extends Comparable, V> = AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
5
+ export type AVLTreeNested<K extends Comparable, V, N extends AVLTreeNode<K, V, N>> = AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
5
6
  export type AVLTreeOptions<K> = BSTOptions<K> & {};
@@ -1,8 +1,8 @@
1
1
  import { BinaryTree, BinaryTreeNode } from '../../../data-structures';
2
2
  import { IterationType } from "../../common";
3
- export type BinaryTreeNodeNested<K, V> = BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
4
- export type BinaryTreeNested<K, V, NODE extends BinaryTreeNode<K, V, NODE>> = BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
5
- export type BinaryTreeOptions<K> = {
3
+ import { Comparable } from "../../utils";
4
+ export type BinaryTreeNodeNested<K extends Comparable, V> = BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
5
+ export type BinaryTreeNested<K extends Comparable, V, NODE extends BinaryTreeNode<K, V, NODE>> = BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
6
+ export type BinaryTreeOptions = {
6
7
  iterationType?: IterationType;
7
- extractor?: (key: K) => number;
8
8
  };
@@ -1,8 +1,9 @@
1
1
  import { BST, BSTNode } from '../../../data-structures';
2
2
  import type { BinaryTreeOptions } from './binary-tree';
3
- import { BSTVariant } from "../../common";
4
- export type BSTNodeNested<K, V> = BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
5
- export type BSTNested<K, V, N extends BSTNode<K, V, N>> = BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
6
- export type BSTOptions<K> = BinaryTreeOptions<K> & {
7
- variant?: BSTVariant;
3
+ import { Comparator } from "../../common";
4
+ import { Comparable } from "../../utils";
5
+ export type BSTNodeNested<K extends Comparable, V> = BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
6
+ export type BSTNested<K extends Comparable, V, N extends BSTNode<K, V, N>> = BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
7
+ export type BSTOptions<K> = BinaryTreeOptions & {
8
+ comparator?: Comparator<K>;
8
9
  };
@@ -1,6 +1,7 @@
1
1
  import { RedBlackTree, RedBlackTreeNode } from '../../../data-structures';
2
2
  import type { BSTOptions } from "./bst";
3
+ import { Comparable } from "../../utils";
3
4
  export type RBTNColor = 'RED' | 'BLACK';
4
- export type RedBlackTreeNodeNested<K, V> = RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
5
- export type RedBlackTreeNested<K, V, N extends RedBlackTreeNode<K, V, N>> = RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
6
- export type RBTreeOptions<K> = Omit<BSTOptions<K>, 'variant'> & {};
5
+ export type RedBlackTreeNodeNested<K extends Comparable, V> = RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
6
+ export type RedBlackTreeNested<K extends Comparable, V, N extends RedBlackTreeNode<K, V, N>> = RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, RedBlackTree<K, V, N, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
7
+ export type RBTreeOptions<K> = BSTOptions<K> & {};
@@ -1,5 +1,6 @@
1
1
  import { TreeMultiMap, TreeMultiMapNode } from '../../../data-structures';
2
2
  import type { RBTreeOptions } from './rb-tree';
3
- export type TreeMultiMapNodeNested<K, V> = TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
4
- export type TreeMultiMapNested<K, V, N extends TreeMultiMapNode<K, V, N>> = TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
3
+ import { Comparable } from "../../utils";
4
+ export type TreeMultiMapNodeNested<K extends Comparable, V> = TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
5
+ export type TreeMultiMapNested<K extends Comparable, V, N extends TreeMultiMapNode<K, V, N>> = TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
5
6
  export type TreeMultiMapOptions<K> = RBTreeOptions<K> & {};