directed-graph-typed 1.53.9 → 1.54.0

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 (33) hide show
  1. package/dist/data-structures/binary-tree/avl-tree-multi-map.d.ts +5 -17
  2. package/dist/data-structures/binary-tree/avl-tree-multi-map.js +1 -20
  3. package/dist/data-structures/binary-tree/avl-tree.d.ts +9 -24
  4. package/dist/data-structures/binary-tree/avl-tree.js +18 -34
  5. package/dist/data-structures/binary-tree/binary-tree.d.ts +40 -37
  6. package/dist/data-structures/binary-tree/binary-tree.js +68 -53
  7. package/dist/data-structures/binary-tree/bst.d.ts +36 -50
  8. package/dist/data-structures/binary-tree/bst.js +45 -60
  9. package/dist/data-structures/binary-tree/red-black-tree.d.ts +29 -43
  10. package/dist/data-structures/binary-tree/red-black-tree.js +45 -59
  11. package/dist/data-structures/binary-tree/tree-multi-map.d.ts +33 -45
  12. package/dist/data-structures/binary-tree/tree-multi-map.js +70 -83
  13. package/dist/interfaces/binary-tree.d.ts +4 -3
  14. package/dist/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +3 -2
  15. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +3 -2
  16. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +3 -2
  17. package/dist/types/data-structures/binary-tree/bst.d.ts +3 -2
  18. package/dist/types/data-structures/binary-tree/rb-tree.d.ts +5 -4
  19. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +3 -2
  20. package/package.json +2 -2
  21. package/src/data-structures/binary-tree/avl-tree-multi-map.ts +23 -31
  22. package/src/data-structures/binary-tree/avl-tree.ts +35 -46
  23. package/src/data-structures/binary-tree/binary-tree.ts +105 -66
  24. package/src/data-structures/binary-tree/bst.ts +105 -104
  25. package/src/data-structures/binary-tree/red-black-tree.ts +68 -73
  26. package/src/data-structures/binary-tree/tree-multi-map.ts +98 -102
  27. package/src/interfaces/binary-tree.ts +16 -3
  28. package/src/types/data-structures/binary-tree/avl-tree-multi-map.ts +4 -2
  29. package/src/types/data-structures/binary-tree/avl-tree.ts +4 -2
  30. package/src/types/data-structures/binary-tree/binary-tree.ts +3 -3
  31. package/src/types/data-structures/binary-tree/bst.ts +4 -2
  32. package/src/types/data-structures/binary-tree/rb-tree.ts +6 -4
  33. package/src/types/data-structures/binary-tree/tree-multi-map.ts +4 -2
@@ -13,6 +13,7 @@ import type {
13
13
  IterationType,
14
14
  OptNode,
15
15
  RBTNColor,
16
+ TreeMultiMapNested,
16
17
  TreeMultiMapNodeNested,
17
18
  TreeMultiMapOptions
18
19
  } from '../../types';
@@ -40,35 +41,29 @@ export class TreeMultiMapNode<
40
41
  super(key, value, color);
41
42
  this.count = count;
42
43
  }
43
-
44
- protected _count: number = 1;
45
-
46
- /**
47
- * The function returns the value of the private variable _count.
48
- * @returns The count property of the object, which is of type number.
49
- */
50
- get count(): number {
51
- return this._count;
52
- }
53
-
54
- /**
55
- * The above function sets the value of the count property.
56
- * @param {number} value - The value parameter is of type number, which means it can accept any
57
- * numeric value.
58
- */
59
- set count(value: number) {
60
- this._count = value;
61
- }
62
44
  }
63
45
 
64
46
  export class TreeMultiMap<
65
47
  K = any,
66
48
  V = any,
67
49
  R = object,
68
- NODE extends TreeMultiMapNode<K, V, NODE> = TreeMultiMapNode<K, V, TreeMultiMapNodeNested<K, V>>
50
+ MK = any,
51
+ MV = any,
52
+ MR = object,
53
+ NODE extends TreeMultiMapNode<K, V, NODE> = TreeMultiMapNode<K, V, TreeMultiMapNodeNested<K, V>>,
54
+ TREE extends TreeMultiMap<K, V, R, MK, MV, MR, NODE, TREE> = TreeMultiMap<
55
+ K,
56
+ V,
57
+ R,
58
+ MK,
59
+ MV,
60
+ MR,
61
+ NODE,
62
+ TreeMultiMapNested<K, V, R, MK, MV, MR, NODE>
63
+ >
69
64
  >
70
- extends RedBlackTree<K, V, R, NODE>
71
- implements IBinaryTree<K, V, R, NODE>
65
+ extends RedBlackTree<K, V, R, MK, MV, MR, NODE, TREE>
66
+ implements IBinaryTree<K, V, R, MK, MV, MR, NODE, TREE>
72
67
  {
73
68
  /**
74
69
  * The constructor function initializes a TreeMultiMap object with optional initial data.
@@ -134,15 +129,53 @@ export class TreeMultiMap<
134
129
  * @returns a new instance of the `TreeMultiMap` class, with the provided options merged with the
135
130
  * existing `iterationType` property. The returned value is casted as `TREE`.
136
131
  */
137
- // @ts-ignore
138
- override createTree(options?: TreeMultiMapOptions<K, V, R>) {
139
- return new TreeMultiMap<K, V, R, NODE>([], {
132
+ override createTree(options?: TreeMultiMapOptions<K, V, R>): TREE {
133
+ return new TreeMultiMap<K, V, R, MK, MV, MR, NODE, TREE>([], {
140
134
  iterationType: this.iterationType,
141
135
  isMapMode: this._isMapMode,
142
136
  specifyComparable: this._specifyComparable,
143
137
  toEntryFn: this._toEntryFn,
144
138
  ...options
145
- });
139
+ }) as TREE;
140
+ }
141
+
142
+ /**
143
+ * The function `keyValueNodeEntryRawToNodeAndValue` takes in a key, value, and count and returns a
144
+ * node based on the input.
145
+ * @param {BTNRep<K, V, NODE> | R} keyNodeEntryOrRaw - The parameter
146
+ * `keyNodeEntryOrRaw` can be of type `R` or `BTNRep<K, V, NODE>`.
147
+ * @param {V} [value] - The `value` parameter is an optional value that represents the value
148
+ * associated with the key in the node. It is used when creating a new node or updating the value of
149
+ * an existing node.
150
+ * @param [count=1] - The `count` parameter is an optional parameter that specifies the number of
151
+ * times the key-value pair should be added to the data structure. If not provided, it defaults to 1.
152
+ * @returns either a NODE object or undefined.
153
+ */
154
+ protected override _keyValueNodeEntryRawToNodeAndValue(
155
+ keyNodeEntryOrRaw: BTNRep<K, V, NODE> | R,
156
+ value?: V,
157
+ count = 1
158
+ ): [NODE | undefined, V | undefined] {
159
+ if (keyNodeEntryOrRaw === undefined || keyNodeEntryOrRaw === null) return [undefined, undefined];
160
+
161
+ if (this.isNode(keyNodeEntryOrRaw)) return [keyNodeEntryOrRaw, value];
162
+
163
+ if (this.isEntry(keyNodeEntryOrRaw)) {
164
+ const [key, entryValue] = keyNodeEntryOrRaw;
165
+ if (key === undefined || key === null) return [undefined, undefined];
166
+ const finalValue = value ?? entryValue;
167
+ if (this.isKey(key)) return [this.createNode(key, finalValue, 'BLACK', count), finalValue];
168
+ }
169
+
170
+ if (this.isRaw(keyNodeEntryOrRaw)) {
171
+ const [key, entryValue] = this._toEntryFn!(keyNodeEntryOrRaw);
172
+ const finalValue = value ?? entryValue;
173
+ if (this.isKey(key)) return [this.createNode(key, finalValue, 'BLACK', count), finalValue];
174
+ }
175
+
176
+ if (this.isKey(keyNodeEntryOrRaw)) return [this.createNode(keyNodeEntryOrRaw, value, 'BLACK', count), value];
177
+
178
+ return [undefined, undefined];
146
179
  }
147
180
 
148
181
  /**
@@ -217,10 +250,12 @@ export class TreeMultiMap<
217
250
  let replacementNode: NODE | undefined;
218
251
 
219
252
  if (!this.isRealNode(nodeToDelete.left)) {
220
- replacementNode = nodeToDelete.right;
253
+ if (nodeToDelete.right !== null) replacementNode = nodeToDelete.right;
221
254
  if (ignoreCount || nodeToDelete.count <= 1) {
222
- this._transplant(nodeToDelete, nodeToDelete.right);
223
- this._count -= nodeToDelete.count;
255
+ if (nodeToDelete.right !== null) {
256
+ this._transplant(nodeToDelete, nodeToDelete.right);
257
+ this._count -= nodeToDelete.count;
258
+ }
224
259
  } else {
225
260
  nodeToDelete.count--;
226
261
  this._count--;
@@ -242,7 +277,7 @@ export class TreeMultiMap<
242
277
  const successor = this.getLeftMost(node => node, nodeToDelete.right);
243
278
  if (successor) {
244
279
  originalColor = successor.color;
245
- replacementNode = successor.right;
280
+ if (successor.right !== null) replacementNode = successor.right;
246
281
 
247
282
  if (successor.parent === nodeToDelete) {
248
283
  if (this.isRealNode(replacementNode)) {
@@ -250,8 +285,10 @@ export class TreeMultiMap<
250
285
  }
251
286
  } else {
252
287
  if (ignoreCount || nodeToDelete.count <= 1) {
253
- this._transplant(successor, successor.right);
254
- this._count -= nodeToDelete.count;
288
+ if (successor.right !== null) {
289
+ this._transplant(successor, successor.right);
290
+ this._count -= nodeToDelete.count;
291
+ }
255
292
  } else {
256
293
  nodeToDelete.count--;
257
294
  this._count--;
@@ -363,82 +400,13 @@ export class TreeMultiMap<
363
400
  * The function overrides the clone method to create a deep copy of a tree object.
364
401
  * @returns The `clone()` method is returning a cloned instance of the `TREE` object.
365
402
  */
366
- // @ts-ignore
367
- override clone() {
403
+ override clone(): TREE {
368
404
  const cloned = this.createTree();
369
405
  this.bfs(node => cloned.add(node.key, undefined, node.count));
370
406
  if (this._isMapMode) cloned._store = this._store;
371
407
  return cloned;
372
408
  }
373
409
 
374
- /**
375
- * The `map` function in TypeScript overrides the default behavior to create a new TreeMultiMap with
376
- * modified entries based on a provided callback.
377
- * @param callback - The `callback` parameter is a function that will be called for each entry in the
378
- * map. It takes four arguments:
379
- * @param [options] - The `options` parameter in the `override map` function is of type
380
- * `TreeMultiMapOptions<MK, MV, MR>`. This parameter allows you to provide additional configuration
381
- * options when creating a new `TreeMultiMap` instance within the `map` function. These options could
382
- * include things like
383
- * @param {any} [thisArg] - The `thisArg` parameter in the `override map` function is used to specify
384
- * the value of `this` when executing the `callback` function. It allows you to set the context
385
- * (value of `this`) for the callback function when it is called within the `map` function. This
386
- * @returns A new TreeMultiMap instance is being returned, which is populated with entries generated
387
- * by the provided callback function.
388
- */
389
- // @ts-ignore
390
- override map<MK, MV, MR>(
391
- callback: EntryCallback<K, V | undefined, [MK, MV]>,
392
- options?: TreeMultiMapOptions<MK, MV, MR>,
393
- thisArg?: any
394
- ) {
395
- const newTree = new TreeMultiMap<MK, MV, MR>([], options);
396
- let index = 0;
397
- for (const [key, value] of this) {
398
- newTree.add(callback.call(thisArg, key, value, index++, this));
399
- }
400
- return newTree;
401
- }
402
-
403
- /**
404
- * The function `keyValueNodeEntryRawToNodeAndValue` takes in a key, value, and count and returns a
405
- * node based on the input.
406
- * @param {BTNRep<K, V, NODE> | R} keyNodeEntryOrRaw - The parameter
407
- * `keyNodeEntryOrRaw` can be of type `R` or `BTNRep<K, V, NODE>`.
408
- * @param {V} [value] - The `value` parameter is an optional value that represents the value
409
- * associated with the key in the node. It is used when creating a new node or updating the value of
410
- * an existing node.
411
- * @param [count=1] - The `count` parameter is an optional parameter that specifies the number of
412
- * times the key-value pair should be added to the data structure. If not provided, it defaults to 1.
413
- * @returns either a NODE object or undefined.
414
- */
415
- protected override _keyValueNodeEntryRawToNodeAndValue(
416
- keyNodeEntryOrRaw: BTNRep<K, V, NODE> | R,
417
- value?: V,
418
- count = 1
419
- ): [NODE | undefined, V | undefined] {
420
- if (keyNodeEntryOrRaw === undefined || keyNodeEntryOrRaw === null) return [undefined, undefined];
421
-
422
- if (this.isNode(keyNodeEntryOrRaw)) return [keyNodeEntryOrRaw, value];
423
-
424
- if (this.isEntry(keyNodeEntryOrRaw)) {
425
- const [key, entryValue] = keyNodeEntryOrRaw;
426
- if (key === undefined || key === null) return [undefined, undefined];
427
- const finalValue = value ?? entryValue;
428
- if (this.isKey(key)) return [this.createNode(key, finalValue, 'BLACK', count), finalValue];
429
- }
430
-
431
- if (this.isRaw(keyNodeEntryOrRaw)) {
432
- const [key, entryValue] = this._toEntryFn!(keyNodeEntryOrRaw);
433
- const finalValue = value ?? entryValue;
434
- if (this.isKey(key)) return [this.createNode(key, finalValue, 'BLACK', count), finalValue];
435
- }
436
-
437
- if (this.isKey(keyNodeEntryOrRaw)) return [this.createNode(keyNodeEntryOrRaw, value, 'BLACK', count), value];
438
-
439
- return [undefined, undefined];
440
- }
441
-
442
410
  /**
443
411
  * Time Complexity: O(1)
444
412
  * Space Complexity: O(1)
@@ -496,4 +464,32 @@ export class TreeMultiMap<
496
464
  newNode.count = oldNode.count + newNode.count;
497
465
  return super._replaceNode(oldNode, newNode);
498
466
  }
467
+
468
+ /**
469
+ * The `map` function in TypeScript overrides the default behavior to create a new TreeMultiMap with
470
+ * modified entries based on a provided callback.
471
+ * @param callback - The `callback` parameter is a function that will be called for each entry in the
472
+ * map. It takes four arguments:
473
+ * @param [options] - The `options` parameter in the `override map` function is of type
474
+ * `TreeMultiMapOptions<MK, MV, MR>`. This parameter allows you to provide additional configuration
475
+ * options when creating a new `TreeMultiMap` instance within the `map` function. These options could
476
+ * include things like
477
+ * @param {any} [thisArg] - The `thisArg` parameter in the `override map` function is used to specify
478
+ * the value of `this` when executing the `callback` function. It allows you to set the context
479
+ * (value of `this`) for the callback function when it is called within the `map` function. This
480
+ * @returns A new TreeMultiMap instance is being returned, which is populated with entries generated
481
+ * by the provided callback function.
482
+ */
483
+ override map(
484
+ callback: EntryCallback<K, V | undefined, [MK, MV]>,
485
+ options?: TreeMultiMapOptions<MK, MV, MR>,
486
+ thisArg?: any
487
+ ): TreeMultiMap<MK, MV, MR> {
488
+ const newTree = new TreeMultiMap<MK, MV, MR>([], options);
489
+ let index = 0;
490
+ for (const [key, value] of this) {
491
+ newTree.add(callback.call(thisArg, key, value, index++, this));
492
+ }
493
+ return newTree;
494
+ }
499
495
  }
@@ -1,14 +1,27 @@
1
- import { BinaryTreeNode } from '../data-structures';
2
- import type { BinaryTreeDeleteResult, BinaryTreeNodeNested, BTNRep, NodePredicate } from '../types';
1
+ import { BinaryTree, BinaryTreeNode } from '../data-structures';
2
+ import type {
3
+ BinaryTreeDeleteResult,
4
+ BinaryTreeNested,
5
+ BinaryTreeNodeNested,
6
+ BinaryTreeOptions,
7
+ BTNRep,
8
+ NodePredicate
9
+ } from '../types';
3
10
 
4
11
  export interface IBinaryTree<
5
12
  K = any,
6
13
  V = any,
7
14
  R = object,
8
- NODE extends BinaryTreeNode<K, V, NODE> = BinaryTreeNodeNested<K, V>
15
+ MK = any,
16
+ MV = any,
17
+ MR = object,
18
+ NODE extends BinaryTreeNode<K, V, NODE> = BinaryTreeNodeNested<K, V>,
19
+ TREE extends BinaryTree<K, V, R, MK, MV, MR, NODE, TREE> = BinaryTreeNested<K, V, R, MK, MV, MR, NODE>
9
20
  > {
10
21
  createNode(key: K, value?: NODE['value']): NODE;
11
22
 
23
+ createTree(options?: Partial<BinaryTreeOptions<K, V, R>>): TREE;
24
+
12
25
  add(keyOrNodeOrEntryOrRawElement: BTNRep<K, V, NODE>, value?: V, count?: number): boolean;
13
26
 
14
27
  addMany(nodes: Iterable<BTNRep<K, V, NODE>>, values?: Iterable<V | undefined>): boolean[];
@@ -1,6 +1,8 @@
1
- import { AVLTreeMultiMapNode } from '../../../data-structures';
1
+ import { AVLTreeMultiMap, AVLTreeMultiMapNode } from '../../../data-structures';
2
2
  import type { AVLTreeOptions } from './avl-tree';
3
3
 
4
- 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, any>>>>>>>>>>
4
+ export type AVLTreeMultiMapNodeNested<K, V> = AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, any>>>
5
+
6
+ export type AVLTreeMultiMapNested<K, V, R, MK, MV, MR, NODE extends AVLTreeMultiMapNode<K, V, NODE>> = AVLTreeMultiMap<K, V, R, MK, MV, MR, NODE, AVLTreeMultiMap<K, V, R, MK, MV, MR, NODE, AVLTreeMultiMap<K, V, R, MK, MV, MR, NODE, any>>>
5
7
 
6
8
  export type AVLTreeMultiMapOptions<K, V, R> = AVLTreeOptions<K, V, R> & {}
@@ -1,6 +1,8 @@
1
- import { AVLTreeNode } from '../../../data-structures';
1
+ import { AVLTree, AVLTreeNode } from '../../../data-structures';
2
2
  import { BSTOptions } from './bst';
3
3
 
4
- 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, any>>>>>>>>>>
4
+ export type AVLTreeNodeNested<K, V> = AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, any>>>
5
+
6
+ export type AVLTreeNested<K, V, R,MK, MV, MR, NODE extends AVLTreeNode<K, V, NODE>> = AVLTree<K, V, R,MK, MV, MR, NODE, AVLTree<K, V, R,MK, MV, MR, NODE, AVLTree<K, V, R,MK, MV, MR, NODE, any>>>
5
7
 
6
8
  export type AVLTreeOptions<K, V, R> = BSTOptions<K, V, R> & {};
@@ -1,10 +1,10 @@
1
- import { BinaryTreeNode } from '../../../data-structures';
1
+ import { BinaryTree, BinaryTreeNode } from '../../../data-structures';
2
2
  import { IterationType, OptValue } from '../../common';
3
3
  import { DFSOperation } from '../../../common';
4
4
 
5
- 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, any>>>>>>>>>>
5
+ export type BinaryTreeNodeNested<K, V> = BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, any>>>
6
6
 
7
- // export type BinaryTreeNested<K, V, R, NODE extends BinaryTreeNode<K, V, NODE>> = BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
7
+ export type BinaryTreeNested<K, V, R, MK, MV, MR, NODE extends BinaryTreeNode<K, V, NODE>> = BinaryTree<K, V, R, MK, MV, MR, NODE,BinaryTree<K, V, R, MK, MV, MR, NODE,BinaryTree<K, V, R, MK, MV, MR, NODE,any>>>
8
8
 
9
9
  export type ToEntryFn<K, V, R> = (rawElement: R) => BTNEntry<K, V>;
10
10
 
@@ -1,8 +1,10 @@
1
- import { BSTNode } from '../../../data-structures';
1
+ import { BST, BSTNode } from '../../../data-structures';
2
2
  import type { BinaryTreeOptions } from './binary-tree';
3
3
  import { Comparable } from '../../utils';
4
4
 
5
- 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, any>>>>>>>>>>
5
+ export type BSTNodeNested<K, V> = BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, any>>>
6
+
7
+ export type BSTNested<K, V, R,MK, MV, MR, NODE extends BSTNode<K, V, NODE>> = BST<K, V, R,MK, MV, MR, NODE,BST<K, V, R,MK, MV, MR, NODE,BST<K, V, R,MK, MV, MR, NODE, any>>>
6
8
 
7
9
  export type BSTOptions<K, V, R> = BinaryTreeOptions<K, V, R> & {
8
10
  specifyComparable?: (key: K) => Comparable
@@ -1,8 +1,10 @@
1
- import { RedBlackTreeNode } from '../../../data-structures';
2
- import type { BSTOptions } from './bst';
1
+ import { RedBlackTree, RedBlackTreeNode } from '../../../data-structures';
2
+ import type { BSTOptions } from "./bst";
3
3
 
4
4
  export type RBTNColor = 'RED' | 'BLACK';
5
5
 
6
- 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, any>>>>>>>>>>
6
+ export type RedBlackTreeNodeNested<K, V> = RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, any>>>
7
7
 
8
- export type RedBlackTreeOptions<K, V, R> = Omit<BSTOptions<K, V, R>, 'isReverse'> & {};
8
+ export type RedBlackTreeNested<K, V, R, MK, MV, MR, NODE extends RedBlackTreeNode<K, V, NODE>> = RedBlackTree<K, V, R, MK, MV, MR, NODE, RedBlackTree<K, V, R, MK, MV, MR, NODE, RedBlackTree<K, V, R, MK, MV, MR, NODE, any>>>
9
+
10
+ export type RedBlackTreeOptions<K, V, R> = BSTOptions<K, V, R> & {};
@@ -1,6 +1,8 @@
1
- import { TreeMultiMapNode } from '../../../data-structures';
1
+ import { TreeMultiMap, TreeMultiMapNode } from '../../../data-structures';
2
2
  import type { RedBlackTreeOptions } from './rb-tree';
3
3
 
4
- 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, any>>>>>>>>>>
4
+ export type TreeMultiMapNodeNested<K, V> = TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, any>>>
5
+
6
+ export type TreeMultiMapNested<K, V, R, MK, MV, MR, NODE extends TreeMultiMapNode<K, V, NODE>> = TreeMultiMap<K, V, R, MK, MV, MR, NODE, TreeMultiMap<K, V, R, MK, MV, MR, NODE,TreeMultiMap<K, V, R, MK, MV, MR, NODE, any>>>
5
7
 
6
8
  export type TreeMultiMapOptions<K, V, R> = RedBlackTreeOptions<K, V, R> & {}