undirected-graph-typed 1.51.8 → 1.52.1

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 (108) hide show
  1. package/dist/data-structures/base/index.d.ts +2 -1
  2. package/dist/data-structures/base/index.js +2 -1
  3. package/dist/data-structures/base/iterable-element-base.d.ts +171 -0
  4. package/dist/data-structures/base/iterable-element-base.js +225 -0
  5. package/dist/data-structures/base/{iterable-base.d.ts → iterable-entry-base.d.ts} +4 -147
  6. package/dist/data-structures/base/{iterable-base.js → iterable-entry-base.js} +12 -189
  7. package/dist/data-structures/binary-tree/avl-tree-multi-map.d.ts +106 -68
  8. package/dist/data-structures/binary-tree/avl-tree-multi-map.js +119 -87
  9. package/dist/data-structures/binary-tree/avl-tree.d.ts +82 -62
  10. package/dist/data-structures/binary-tree/avl-tree.js +78 -59
  11. package/dist/data-structures/binary-tree/binary-tree.d.ts +333 -241
  12. package/dist/data-structures/binary-tree/binary-tree.js +478 -366
  13. package/dist/data-structures/binary-tree/bst.d.ts +202 -212
  14. package/dist/data-structures/binary-tree/bst.js +208 -250
  15. package/dist/data-structures/binary-tree/rb-tree.d.ts +73 -74
  16. package/dist/data-structures/binary-tree/rb-tree.js +107 -98
  17. package/dist/data-structures/binary-tree/tree-multi-map.d.ts +92 -75
  18. package/dist/data-structures/binary-tree/tree-multi-map.js +105 -93
  19. package/dist/data-structures/graph/abstract-graph.d.ts +10 -15
  20. package/dist/data-structures/graph/abstract-graph.js +10 -15
  21. package/dist/data-structures/graph/directed-graph.js +2 -1
  22. package/dist/data-structures/hash/hash-map.d.ts +33 -40
  23. package/dist/data-structures/hash/hash-map.js +40 -55
  24. package/dist/data-structures/heap/heap.d.ts +43 -114
  25. package/dist/data-structures/heap/heap.js +59 -127
  26. package/dist/data-structures/heap/max-heap.d.ts +50 -4
  27. package/dist/data-structures/heap/max-heap.js +76 -10
  28. package/dist/data-structures/heap/min-heap.d.ts +51 -5
  29. package/dist/data-structures/heap/min-heap.js +68 -11
  30. package/dist/data-structures/linked-list/doubly-linked-list.d.ts +22 -28
  31. package/dist/data-structures/linked-list/doubly-linked-list.js +26 -28
  32. package/dist/data-structures/linked-list/singly-linked-list.d.ts +22 -25
  33. package/dist/data-structures/linked-list/singly-linked-list.js +29 -26
  34. package/dist/data-structures/priority-queue/max-priority-queue.d.ts +50 -4
  35. package/dist/data-structures/priority-queue/max-priority-queue.js +79 -10
  36. package/dist/data-structures/priority-queue/min-priority-queue.d.ts +51 -5
  37. package/dist/data-structures/priority-queue/min-priority-queue.js +71 -11
  38. package/dist/data-structures/priority-queue/priority-queue.d.ts +50 -4
  39. package/dist/data-structures/priority-queue/priority-queue.js +70 -1
  40. package/dist/data-structures/queue/deque.d.ts +28 -20
  41. package/dist/data-structures/queue/deque.js +45 -24
  42. package/dist/data-structures/queue/queue.d.ts +8 -29
  43. package/dist/data-structures/queue/queue.js +15 -32
  44. package/dist/data-structures/stack/stack.d.ts +17 -22
  45. package/dist/data-structures/stack/stack.js +25 -24
  46. package/dist/data-structures/trie/trie.d.ts +19 -14
  47. package/dist/data-structures/trie/trie.js +27 -16
  48. package/dist/interfaces/binary-tree.d.ts +7 -7
  49. package/dist/types/common.d.ts +1 -23
  50. package/dist/types/data-structures/base/base.d.ts +5 -2
  51. package/dist/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +3 -4
  52. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +3 -4
  53. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +22 -5
  54. package/dist/types/data-structures/binary-tree/bst.d.ts +7 -5
  55. package/dist/types/data-structures/binary-tree/rb-tree.d.ts +3 -4
  56. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +3 -4
  57. package/dist/types/data-structures/heap/heap.d.ts +3 -2
  58. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +2 -1
  59. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +2 -1
  60. package/dist/types/data-structures/priority-queue/priority-queue.d.ts +1 -1
  61. package/dist/types/data-structures/queue/deque.d.ts +4 -2
  62. package/dist/types/data-structures/queue/queue.d.ts +2 -1
  63. package/dist/types/data-structures/stack/stack.d.ts +2 -1
  64. package/dist/types/data-structures/trie/trie.d.ts +3 -2
  65. package/dist/utils/utils.js +3 -5
  66. package/package.json +2 -2
  67. package/src/data-structures/base/index.ts +2 -1
  68. package/src/data-structures/base/iterable-element-base.ts +250 -0
  69. package/src/data-structures/base/{iterable-base.ts → iterable-entry-base.ts} +22 -213
  70. package/src/data-structures/binary-tree/avl-tree-multi-map.ts +146 -97
  71. package/src/data-structures/binary-tree/avl-tree.ts +97 -70
  72. package/src/data-structures/binary-tree/binary-tree.ts +591 -455
  73. package/src/data-structures/binary-tree/bst.ts +266 -293
  74. package/src/data-structures/binary-tree/rb-tree.ts +124 -104
  75. package/src/data-structures/binary-tree/tree-multi-map.ts +128 -103
  76. package/src/data-structures/graph/abstract-graph.ts +10 -10
  77. package/src/data-structures/graph/directed-graph.ts +2 -1
  78. package/src/data-structures/hash/hash-map.ts +46 -53
  79. package/src/data-structures/heap/heap.ts +71 -152
  80. package/src/data-structures/heap/max-heap.ts +88 -13
  81. package/src/data-structures/heap/min-heap.ts +78 -15
  82. package/src/data-structures/linked-list/doubly-linked-list.ts +32 -32
  83. package/src/data-structures/linked-list/singly-linked-list.ts +37 -29
  84. package/src/data-structures/priority-queue/max-priority-queue.ts +94 -13
  85. package/src/data-structures/priority-queue/min-priority-queue.ts +84 -15
  86. package/src/data-structures/priority-queue/priority-queue.ts +81 -4
  87. package/src/data-structures/queue/deque.ts +52 -27
  88. package/src/data-structures/queue/queue.ts +23 -37
  89. package/src/data-structures/stack/stack.ts +31 -26
  90. package/src/data-structures/trie/trie.ts +35 -20
  91. package/src/interfaces/binary-tree.ts +10 -10
  92. package/src/types/common.ts +2 -25
  93. package/src/types/data-structures/base/base.ts +14 -6
  94. package/src/types/data-structures/binary-tree/avl-tree-multi-map.ts +3 -4
  95. package/src/types/data-structures/binary-tree/avl-tree.ts +3 -4
  96. package/src/types/data-structures/binary-tree/binary-tree.ts +26 -6
  97. package/src/types/data-structures/binary-tree/bst.ts +11 -5
  98. package/src/types/data-structures/binary-tree/rb-tree.ts +3 -4
  99. package/src/types/data-structures/binary-tree/tree-multi-map.ts +3 -4
  100. package/src/types/data-structures/heap/heap.ts +4 -1
  101. package/src/types/data-structures/linked-list/doubly-linked-list.ts +3 -1
  102. package/src/types/data-structures/linked-list/singly-linked-list.ts +3 -1
  103. package/src/types/data-structures/priority-queue/priority-queue.ts +1 -1
  104. package/src/types/data-structures/queue/deque.ts +6 -1
  105. package/src/types/data-structures/queue/queue.ts +3 -1
  106. package/src/types/data-structures/stack/stack.ts +3 -1
  107. package/src/types/data-structures/trie/trie.ts +3 -1
  108. package/src/utils/utils.ts +3 -3
@@ -16,9 +16,9 @@ import { calcMinUnitsRequired, rangeCheck } from '../../utils';
16
16
  * 4. Efficiency: Adding and removing elements at both ends of a deque is usually very fast. However, when the dynamic array needs to expand, it may involve copying the entire array to a larger one, and this operation has a time complexity of O(n).
17
17
  * 5. Performance jitter: Deque may experience performance jitter, but DoublyLinkedList will not
18
18
  */
19
- export class Deque<E> extends IterableElementBase<E> {
19
+ export class Deque<E = any, R = any> extends IterableElementBase<E, R, Deque<E, R>> {
20
20
  /**
21
- * The constructor initializes a Deque object with an optional iterable of elements and options.
21
+ * The constructor initializes a Deque object with optional iterable of elements and options.
22
22
  * @param elements - An iterable object (such as an array or a Set) that contains the initial
23
23
  * elements to be added to the deque. It can also be an object with a `length` or `size` property
24
24
  * that represents the number of elements in the iterable object. If no elements are provided, an
@@ -28,12 +28,13 @@ export class Deque<E> extends IterableElementBase<E> {
28
28
  * which determines the size of each bucket in the deque. If the `bucketSize` option is not provided
29
29
  * or is not a number
30
30
  */
31
- constructor(elements: IterableWithSizeOrLength<E> = [], options?: DequeOptions) {
32
- super();
31
+ constructor(elements: IterableWithSizeOrLength<E> | IterableWithSizeOrLength<R> = [], options?: DequeOptions<E, R>) {
32
+ super(options);
33
33
 
34
34
  if (options) {
35
- const { bucketSize } = options;
35
+ const { bucketSize, maxLen } = options;
36
36
  if (typeof bucketSize === 'number') this._bucketSize = bucketSize;
37
+ if (typeof maxLen === 'number' && maxLen > 0 && maxLen % 1 === 0) this._maxLen = maxLen;
37
38
  }
38
39
 
39
40
  let _size: number;
@@ -53,8 +54,12 @@ export class Deque<E> extends IterableElementBase<E> {
53
54
  this._bucketFirst = this._bucketLast = (this._bucketCount >> 1) - (needBucketNum >> 1);
54
55
  this._firstInBucket = this._lastInBucket = (this._bucketSize - (_size % this._bucketSize)) >> 1;
55
56
 
56
- for (const element of elements) {
57
- this.push(element);
57
+ for (const el of elements) {
58
+ if (this.toElementFn) {
59
+ this.push(this.toElementFn(el as R));
60
+ } else {
61
+ this.push(el as E);
62
+ }
58
63
  }
59
64
  }
60
65
 
@@ -69,6 +74,17 @@ export class Deque<E> extends IterableElementBase<E> {
69
74
  return this._bucketSize;
70
75
  }
71
76
 
77
+ protected _maxLen: number = -1;
78
+
79
+ /**
80
+ * The maxLen function returns the max length of the deque.
81
+ *
82
+ * @return The max length of the deque
83
+ */
84
+ get maxLen() {
85
+ return this._maxLen;
86
+ }
87
+
72
88
  protected _bucketFirst = 0;
73
89
 
74
90
  /**
@@ -189,6 +205,7 @@ export class Deque<E> extends IterableElementBase<E> {
189
205
  }
190
206
  this._size += 1;
191
207
  this._buckets[this._bucketLast][this._lastInBucket] = element;
208
+ if (this._maxLen > 0 && this._size > this._maxLen) this.shift();
192
209
  return true;
193
210
  }
194
211
 
@@ -253,6 +270,7 @@ export class Deque<E> extends IterableElementBase<E> {
253
270
  }
254
271
  this._size += 1;
255
272
  this._buckets[this._bucketFirst][this._firstInBucket] = element;
273
+ if (this._maxLen > 0 && this._size > this._maxLen) this.pop();
256
274
  return true;
257
275
  }
258
276
 
@@ -747,8 +765,8 @@ export class Deque<E> extends IterableElementBase<E> {
747
765
  * @returns The `clone()` method is returning a new instance of the `Deque` class with the same
748
766
  * elements as the original deque (`this`) and the same bucket size.
749
767
  */
750
- clone(): Deque<E> {
751
- return new Deque<E>([...this], { bucketSize: this.bucketSize });
768
+ clone(): Deque<E, R> {
769
+ return new Deque<E, R>(this, { bucketSize: this.bucketSize, toElementFn: this.toElementFn });
752
770
  }
753
771
 
754
772
  /**
@@ -772,8 +790,8 @@ export class Deque<E> extends IterableElementBase<E> {
772
790
  * @returns The `filter` method is returning a new `Deque` object that contains the elements that
773
791
  * satisfy the given predicate function.
774
792
  */
775
- filter(predicate: ElementCallback<E, boolean>, thisArg?: any): Deque<E> {
776
- const newDeque = new Deque<E>([], { bucketSize: this._bucketSize });
793
+ filter(predicate: ElementCallback<E, R, boolean, Deque<E, R>>, thisArg?: any): Deque<E, R> {
794
+ const newDeque = new Deque<E, R>([], { bucketSize: this._bucketSize, toElementFn: this.toElementFn });
777
795
  let index = 0;
778
796
  for (const el of this) {
779
797
  if (predicate.call(thisArg, el, index, this)) {
@@ -788,21 +806,28 @@ export class Deque<E> extends IterableElementBase<E> {
788
806
  * Time Complexity: O(n)
789
807
  * Space Complexity: O(n)
790
808
  */
809
+
791
810
  /**
792
- * Time Complexity: O(n)
793
- * Space Complexity: O(n)
794
- *
795
- * The `map` function creates a new Deque by applying a callback function to each element of the
796
- * original Deque.
797
- * @param callback - The `callback` parameter is a function that will be called for each element in
798
- * the deque. It takes three arguments:
799
- * @param {any} [thisArg] - The `thisArg` parameter is an optional argument that specifies the value
800
- * to be used as `this` when executing the `callback` function. If `thisArg` is provided, it will be
801
- * passed as the `this` value to the `callback` function. If `thisArg` is
802
- * @returns a new Deque object with the mapped values.
803
- */
804
- map<T>(callback: ElementCallback<E, T>, thisArg?: any): Deque<T> {
805
- const newDeque = new Deque<T>([], { bucketSize: this._bucketSize });
811
+ * The `map` function takes a callback function and applies it to each element in the deque,
812
+ * returning a new deque with the results.
813
+ * @param callback - The callback parameter is a function that will be called for each element in the
814
+ * deque. It takes three arguments: the current element, the index of the element, and the deque
815
+ * itself. It should return a value of type EM.
816
+ * @param [toElementFn] - The `toElementFn` parameter is an optional function that can be used to
817
+ * transform the raw element (`RM`) into a new element (`EM`) before adding it to the new deque. If
818
+ * provided, this function will be called for each raw element in the original deque.
819
+ * @param {any} [thisArg] - The `thisArg` parameter is an optional argument that allows you to
820
+ * specify the value of `this` within the callback function. It is used to set the context or scope
821
+ * in which the callback function will be executed. If `thisArg` is provided, it will be used as the
822
+ * value of
823
+ * @returns a new Deque object with elements of type EM and raw elements of type RM.
824
+ */
825
+ map<EM, RM>(
826
+ callback: ElementCallback<E, R, EM, Deque<E, R>>,
827
+ toElementFn?: (rawElement: RM) => EM,
828
+ thisArg?: any
829
+ ): Deque<EM, RM> {
830
+ const newDeque = new Deque<EM, RM>([], { bucketSize: this._bucketSize, toElementFn });
806
831
  let index = 0;
807
832
  for (const el of this) {
808
833
  newDeque.push(callback.call(thisArg, el, index, this));
@@ -814,9 +839,9 @@ export class Deque<E> extends IterableElementBase<E> {
814
839
  /**
815
840
  * Time Complexity: O(n)
816
841
  * Space Complexity: O(1)
817
- * /
842
+ */
818
843
 
819
- /**
844
+ /**
820
845
  * Time Complexity: O(n)
821
846
  * Space Complexity: O(1)
822
847
  *
@@ -3,7 +3,7 @@
3
3
  * @copyright Tyler Zeng <zrwusa@gmail.com>
4
4
  * @class
5
5
  */
6
- import type { ElementCallback } from '../../types';
6
+ import type { ElementCallback, QueueOptions } from '../../types';
7
7
  import { IterableElementBase } from '../base';
8
8
  import { SinglyLinkedList } from '../linked-list';
9
9
 
@@ -16,17 +16,14 @@ import { SinglyLinkedList } from '../linked-list';
16
16
  * 6. Breadth-First Search (BFS): In traversal algorithms for graphs and trees, queues store elements that are to be visited.
17
17
  * 7. Real-time Queuing: Like queuing systems in banks or supermarkets.
18
18
  */
19
- export class Queue<E = any> extends IterableElementBase<E> {
20
- /**
21
- * The constructor initializes an instance of a class with an optional array of elements and sets the offset to 0.
22
- * @param {E[]} [elements] - The `elements` parameter is an optional array of elements of type `E`. If provided, it
23
- * will be used to initialize the `_elements` property of the class. If not provided, the `_elements` property will be
24
- * initialized as an empty array.
25
- */
26
- constructor(elements: Iterable<E> = []) {
27
- super();
19
+ export class Queue<E = any, R = any> extends IterableElementBase<E, R, Queue<E, R>> {
20
+ constructor(elements: Iterable<E> | Iterable<R> = [], options?: QueueOptions<E, R>) {
21
+ super(options);
28
22
  if (elements) {
29
- for (const el of elements) this.push(el);
23
+ for (const el of elements) {
24
+ if (this.toElementFn) this.push(this.toElementFn(el as R));
25
+ else this.push(el as E);
26
+ }
30
27
  }
31
28
  }
32
29
 
@@ -103,7 +100,6 @@ export class Queue<E = any> extends IterableElementBase<E> {
103
100
  *
104
101
  * The function "fromArray" creates a new Queue object from an array of elements.Creates a queue from an existing array.
105
102
  * @public
106
- * @static
107
103
  * @param {E[]} elements - The "elements" parameter is an array of elements of type E.
108
104
  * @returns The method is returning a new instance of the Queue class, initialized with the elements from the input
109
105
  * array.
@@ -190,7 +186,7 @@ export class Queue<E = any> extends IterableElementBase<E> {
190
186
  * @param index
191
187
  */
192
188
  at(index: number): E | undefined {
193
- return this.elements[index];
189
+ return this.elements[index + this._offset];
194
190
  }
195
191
 
196
192
  /**
@@ -254,8 +250,8 @@ export class Queue<E = any> extends IterableElementBase<E> {
254
250
  * The `clone()` function returns a new Queue object with the same elements as the original Queue.
255
251
  * @returns The `clone()` method is returning a new instance of the `Queue` class.
256
252
  */
257
- clone(): Queue<E> {
258
- return new Queue(this.elements.slice(this.offset));
253
+ clone(): Queue<E, R> {
254
+ return new Queue(this.elements.slice(this.offset), { toElementFn: this.toElementFn });
259
255
  }
260
256
 
261
257
  /**
@@ -279,8 +275,8 @@ export class Queue<E = any> extends IterableElementBase<E> {
279
275
  * @returns The `filter` method is returning a new `Queue` object that contains the elements that
280
276
  * satisfy the given predicate function.
281
277
  */
282
- filter(predicate: ElementCallback<E, boolean>, thisArg?: any): Queue<E> {
283
- const newDeque = new Queue<E>([]);
278
+ filter(predicate: ElementCallback<E, R, boolean, Queue<E, R>>, thisArg?: any): Queue<E, R> {
279
+ const newDeque = new Queue<E, R>([], { toElementFn: this.toElementFn });
284
280
  let index = 0;
285
281
  for (const el of this) {
286
282
  if (predicate.call(thisArg, el, index, this)) {
@@ -296,22 +292,12 @@ export class Queue<E = any> extends IterableElementBase<E> {
296
292
  * Space Complexity: O(n)
297
293
  */
298
294
 
299
- /**
300
- * Time Complexity: O(n)
301
- * Space Complexity: O(n)
302
- *
303
- * The `map` function takes a callback function and applies it to each element in the queue,
304
- * returning a new queue with the results.
305
- * @param callback - The callback parameter is a function that will be called for each element in the
306
- * queue. It takes three arguments: the current element, the index of the current element, and the
307
- * queue itself. The callback function should return a new value that will be added to the new queue.
308
- * @param {any} [thisArg] - The `thisArg` parameter is an optional argument that specifies the value
309
- * to be used as `this` when executing the `callback` function. If `thisArg` is provided, it will be
310
- * passed as the `this` value to the `callback` function. If `thisArg` is
311
- * @returns The `map` function is returning a new `Queue` object with the transformed elements.
312
- */
313
- map<T>(callback: ElementCallback<E, T>, thisArg?: any): Queue<T> {
314
- const newDeque = new Queue<T>([]);
295
+ map<EM, RM>(
296
+ callback: ElementCallback<E, R, EM, Queue<E, R>>,
297
+ toElementFn?: (rawElement: RM) => EM,
298
+ thisArg?: any
299
+ ): Queue<EM, RM> {
300
+ const newDeque = new Queue<EM, RM>([], { toElementFn });
315
301
  let index = 0;
316
302
  for (const el of this) {
317
303
  newDeque.push(callback.call(thisArg, el, index, this));
@@ -332,7 +318,7 @@ export class Queue<E = any> extends IterableElementBase<E> {
332
318
  * The function `_getIterator` returns an iterable iterator for the elements in the class.
333
319
  */
334
320
  protected* _getIterator(): IterableIterator<E> {
335
- for (const item of this.elements) {
321
+ for (const item of this.elements.slice(this.offset)) {
336
322
  yield item;
337
323
  }
338
324
  }
@@ -344,7 +330,7 @@ export class Queue<E = any> extends IterableElementBase<E> {
344
330
  * 3. Memory Usage: Since each element requires additional space to store a pointer to the next element, linked lists may use more memory compared to arrays.
345
331
  * 4. Frequent Enqueuing and Dequeuing Operations: If your application involves frequent enqueuing and dequeuing operations and is less concerned with random access, then LinkedListQueue is a good choice.
346
332
  */
347
- export class LinkedListQueue<E = any> extends SinglyLinkedList<E> {
333
+ export class LinkedListQueue<E = any, R = any> extends SinglyLinkedList<E, R> {
348
334
  /**
349
335
  * Time Complexity: O(n)
350
336
  * Space Complexity: O(n)
@@ -358,7 +344,7 @@ export class LinkedListQueue<E = any> extends SinglyLinkedList<E> {
358
344
  * @returns The `clone()` method is returning a new instance of `LinkedListQueue` with the same
359
345
  * values as the original `LinkedListQueue`.
360
346
  */
361
- clone(): LinkedListQueue<E> {
362
- return new LinkedListQueue<E>(this.values());
347
+ override clone(): LinkedListQueue<E, R> {
348
+ return new LinkedListQueue<E, R>(this, { toElementFn: this.toElementFn });
363
349
  }
364
350
  }
@@ -5,7 +5,7 @@
5
5
  * @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
6
6
  * @license MIT License
7
7
  */
8
- import type { ElementCallback } from '../../types';
8
+ import type { ElementCallback, StackOptions } from '../../types';
9
9
  import { IterableElementBase } from '../base';
10
10
 
11
11
  /**
@@ -16,17 +16,17 @@ import { IterableElementBase } from '../base';
16
16
  * 5. Expression Evaluation: Used for the evaluation of arithmetic or logical expressions, especially when dealing with parenthesis matching and operator precedence.
17
17
  * 6. Backtracking Algorithms: In problems where multiple branches need to be explored but only one branch can be explored at a time, stacks can be used to save the state at each branching point.
18
18
  */
19
- export class Stack<E = any> extends IterableElementBase<E> {
20
- /**
21
- * The constructor initializes an array of elements, which can be provided as an optional parameter.
22
- * @param {E[]} [elements] - The `elements` parameter is an optional parameter of type `E[]`, which represents an array
23
- * of elements of type `E`. It is used to initialize the `_elements` property of the class. If the `elements` parameter
24
- * is provided and is an array, it is assigned to the `_elements
25
- */
26
- constructor(elements: Iterable<E> = []) {
27
- super();
19
+ export class Stack<E = any, R = any> extends IterableElementBase<E, R, Stack<E, R>> {
20
+ constructor(elements: Iterable<E> | Iterable<R> = [], options?: StackOptions<E, R>) {
21
+ super(options);
28
22
  if (elements) {
29
- for (const el of elements) this.push(el);
23
+ for (const el of elements) {
24
+ if (this.toElementFn) {
25
+ this.push(this.toElementFn(el as R));
26
+ } else {
27
+ this.push(el as E);
28
+ }
29
+ }
30
30
  }
31
31
  }
32
32
 
@@ -192,8 +192,8 @@ export class Stack<E = any> extends IterableElementBase<E> {
192
192
  * The `clone()` function returns a new `Stack` object with the same elements as the original stack.
193
193
  * @returns The `clone()` method is returning a new `Stack` object with a copy of the `_elements` array.
194
194
  */
195
- clone(): Stack<E> {
196
- return new Stack(this.elements.slice());
195
+ clone(): Stack<E, R> {
196
+ return new Stack<E, R>(this, { toElementFn: this.toElementFn });
197
197
  }
198
198
 
199
199
  /**
@@ -217,8 +217,8 @@ export class Stack<E = any> extends IterableElementBase<E> {
217
217
  * @returns The `filter` method is returning a new `Stack` object that contains the elements that
218
218
  * satisfy the given predicate function.
219
219
  */
220
- filter(predicate: ElementCallback<E, boolean>, thisArg?: any): Stack<E> {
221
- const newStack = new Stack<E>();
220
+ filter(predicate: ElementCallback<E, R, boolean, Stack<E, R>>, thisArg?: any): Stack<E, R> {
221
+ const newStack = new Stack<E, R>([], { toElementFn: this.toElementFn });
222
222
  let index = 0;
223
223
  for (const el of this) {
224
224
  if (predicate.call(thisArg, el, index, this)) {
@@ -235,20 +235,25 @@ export class Stack<E = any> extends IterableElementBase<E> {
235
235
  */
236
236
 
237
237
  /**
238
- * Time Complexity: O(n)
239
- * Space Complexity: O(n)
240
- *
241
238
  * The `map` function takes a callback function and applies it to each element in the stack,
242
239
  * returning a new stack with the results.
243
- * @param callback - The `callback` parameter is a function that will be called for each element in
244
- * the stack. It takes three arguments:
245
- * @param {any} [thisArg] - The `thisArg` parameter is an optional argument that specifies the value
246
- * to be used as `this` when executing the `callback` function. If `thisArg` is provided, it will be
247
- * passed as the `this` value to the `callback` function. If `thisArg` is
248
- * @returns The `map` method is returning a new `Stack` object.
240
+ * @param callback - The callback parameter is a function that will be called for each element in the
241
+ * stack. It takes three arguments: the current element, the index of the element, and the stack
242
+ * itself. It should return a new value that will be added to the new stack.
243
+ * @param [toElementFn] - The `toElementFn` parameter is an optional function that can be used to
244
+ * transform the raw element (`RM`) into a new element (`EM`) before pushing it into the new stack.
245
+ * @param {any} [thisArg] - The `thisArg` parameter is an optional argument that allows you to
246
+ * specify the value of `this` within the callback function. It is used to set the context or scope
247
+ * in which the callback function will be executed. If `thisArg` is provided, it will be used as the
248
+ * value of
249
+ * @returns a new Stack object with elements of type EM and raw elements of type RM.
249
250
  */
250
- map<T>(callback: ElementCallback<E, T>, thisArg?: any): Stack<T> {
251
- const newStack = new Stack<T>();
251
+ map<EM, RM>(
252
+ callback: ElementCallback<E, R, EM, Stack<E, R>>,
253
+ toElementFn?: (rawElement: RM) => EM,
254
+ thisArg?: any
255
+ ): Stack<EM, RM> {
256
+ const newStack = new Stack<EM, RM>([], { toElementFn });
252
257
  let index = 0;
253
258
  for (const el of this) {
254
259
  newStack.push(callback.call(thisArg, el, index, this));
@@ -91,23 +91,29 @@ export class TrieNode {
91
91
  * 8. Autocomplete: Providing recommended words or phrases as a user types.
92
92
  * 9. Spell Check: Checking the spelling of words.
93
93
  * 10. IP Routing: Used in certain types of IP routing algorithms.
94
- * 11. Text Word Frequency Count: Counting and storing the frequency of words in a large amount of text data."
94
+ * 11. Text Word Frequency Count: Counting and storing the frequency of words in a large amount of text data.
95
95
  */
96
- export class Trie extends IterableElementBase<string, Trie> {
96
+ export class Trie<R = any> extends IterableElementBase<string, R, Trie<R>> {
97
97
  /**
98
98
  * The constructor function for the Trie class.
99
99
  * @param words: Iterable string Initialize the trie with a set of words
100
100
  * @param options?: TrieOptions Allow the user to pass in options for the trie
101
101
  * @return This
102
102
  */
103
- constructor(words: Iterable<string> = [], options?: TrieOptions) {
104
- super();
103
+ constructor(words: Iterable<string> | Iterable<R> = [], options?: TrieOptions<R>) {
104
+ super(options);
105
105
  if (options) {
106
106
  const { caseSensitive } = options;
107
107
  if (caseSensitive !== undefined) this._caseSensitive = caseSensitive;
108
108
  }
109
109
  if (words) {
110
- for (const word of words) this.add(word);
110
+ for (const word of words) {
111
+ if (this.toElementFn) {
112
+ this.add(this.toElementFn(word as R));
113
+ } else {
114
+ this.add(word as string);
115
+ }
116
+ }
111
117
  }
112
118
  }
113
119
 
@@ -187,7 +193,7 @@ export class Trie extends IterableElementBase<string, Trie> {
187
193
  * @param {string} word - The word to check for.
188
194
  * @returns {boolean} True if the word is present in the Trie.
189
195
  */
190
- has(word: string): boolean {
196
+ override has(word: string): boolean {
191
197
  word = this._caseProcess(word);
192
198
  let cur = this.root;
193
199
  for (const c of word) {
@@ -470,8 +476,8 @@ export class Trie extends IterableElementBase<string, Trie> {
470
476
  * sensitivity as the original Trie.
471
477
  * @returns A new instance of the Trie class is being returned.
472
478
  */
473
- clone(): Trie {
474
- return new Trie(this.values(), { caseSensitive: this.caseSensitive });
479
+ clone(): Trie<R> {
480
+ return new Trie<R>(this, { caseSensitive: this.caseSensitive, toElementFn: this.toElementFn });
475
481
  }
476
482
 
477
483
  /**
@@ -493,8 +499,8 @@ export class Trie extends IterableElementBase<string, Trie> {
493
499
  * specific object as the context for the `predicate` function. If `thisArg` is provided, it will be
494
500
  * @returns The `filter` method is returning an array of strings (`string[]`).
495
501
  */
496
- filter(predicate: ElementCallback<string, boolean>, thisArg?: any): Trie {
497
- const results: Trie = new Trie();
502
+ filter(predicate: ElementCallback<string, R, boolean, Trie<R>>, thisArg?: any): Trie<R> {
503
+ const results = new Trie<R>([], { toElementFn: this.toElementFn, caseSensitive: this.caseSensitive });
498
504
  let index = 0;
499
505
  for (const word of this) {
500
506
  if (predicate.call(thisArg, word, index, this)) {
@@ -514,17 +520,26 @@ export class Trie extends IterableElementBase<string, Trie> {
514
520
  * Time Complexity: O(n)
515
521
  * Space Complexity: O(n)
516
522
  *
517
- * The `map` function creates a new Trie by applying a callback function to each element in the Trie.
523
+ * The `map` function creates a new Trie by applying a callback function to each element in the
524
+ * current Trie.
518
525
  * @param callback - The callback parameter is a function that will be called for each element in the
519
- * Trie. It takes three arguments: the current element in the Trie, the index of the current element,
520
- * and the Trie itself. The callback function should return a new value for the element.
521
- * @param {any} [thisArg] - The `thisArg` parameter is an optional argument that specifies the value
522
- * to be used as `this` when executing the `callback` function. If `thisArg` is provided, it will be
523
- * passed as the `this` value to the `callback` function. If `thisArg` is
524
- * @returns The `map` function is returning a new Trie object.
525
- */
526
- map(callback: ElementCallback<string, string>, thisArg?: any): Trie {
527
- const newTrie = new Trie();
526
+ * Trie. It takes four arguments:
527
+ * @param [toElementFn] - The `toElementFn` parameter is an optional function that can be used to
528
+ * convert the raw element (`RM`) into a string representation. This can be useful if the raw element
529
+ * is not already a string or if you want to customize how the element is converted into a string. If
530
+ * this parameter is
531
+ * @param {any} [thisArg] - The `thisArg` parameter is an optional argument that allows you to
532
+ * specify the value of `this` within the callback function. It is used to set the context or scope
533
+ * in which the callback function will be executed. If `thisArg` is provided, it will be used as the
534
+ * value of
535
+ * @returns a new Trie object.
536
+ */
537
+ map<RM>(
538
+ callback: ElementCallback<string, R, string, Trie<R>>,
539
+ toElementFn?: (rawElement: RM) => string,
540
+ thisArg?: any
541
+ ): Trie<RM> {
542
+ const newTrie = new Trie<RM>([], { toElementFn, caseSensitive: this.caseSensitive });
528
543
  let index = 0;
529
544
  for (const word of this) {
530
545
  newTrie.add(callback.call(thisArg, word, index, this));
@@ -5,23 +5,23 @@ import type {
5
5
  BinaryTreeNodeNested,
6
6
  BinaryTreeOptions,
7
7
  BTNCallback,
8
- Comparable,
9
- KeyOrNodeOrEntry
8
+ BTNKeyOrNodeOrEntry
10
9
  } from '../types';
11
10
 
12
11
  export interface IBinaryTree<
13
- K extends Comparable,
12
+ K = any,
14
13
  V = any,
15
- N extends BinaryTreeNode<K, V, N> = BinaryTreeNodeNested<K, V>,
16
- TREE extends BinaryTree<K, V, N, TREE> = BinaryTreeNested<K, V, N>
14
+ R = [K, V],
15
+ NODE extends BinaryTreeNode<K, V, NODE> = BinaryTreeNodeNested<K, V>,
16
+ TREE extends BinaryTree<K, V, R, NODE, TREE> = BinaryTreeNested<K, V, R, NODE>
17
17
  > {
18
- createNode(key: K, value?: N['value']): N;
18
+ createNode(key: K, value?: NODE['value']): NODE;
19
19
 
20
- createTree(options?: Partial<BinaryTreeOptions>): TREE;
20
+ createTree(options?: Partial<BinaryTreeOptions<K, V, R>>): TREE;
21
21
 
22
- add(keyOrNodeOrEntry: KeyOrNodeOrEntry<K, V, N>, value?: V, count?: number): boolean;
22
+ add(keyOrNodeOrEntryOrRawElement: BTNKeyOrNodeOrEntry<K, V, NODE>, value?: V, count?: number): boolean;
23
23
 
24
- addMany(nodes: Iterable<KeyOrNodeOrEntry<K, V, N>>, values?: Iterable<V | undefined>): boolean[];
24
+ addMany(nodes: Iterable<BTNKeyOrNodeOrEntry<K, V, NODE>>, values?: Iterable<V | undefined>): boolean[];
25
25
 
26
- delete<C extends BTNCallback<N>>(identifier: ReturnType<C> | null, callback: C): BinaryTreeDeleteResult<N>[];
26
+ delete<C extends BTNCallback<NODE>>(identifier: ReturnType<C> | null, callback: C): BinaryTreeDeleteResult<NODE>[];
27
27
  }
@@ -1,12 +1,5 @@
1
- export type BSTVariant = 'STANDARD' | 'INVERSE';
2
1
  export type CP = 1 | -1 | 0;
3
2
 
4
- /**
5
- * Enum representing different loop types.
6
- *
7
- * - `iterative`: Indicates the iterative loop type (with loops that use iterations).
8
- * - `recursive`: Indicates the recursive loop type (with loops that call themselves).
9
- */
10
3
  export type IterationType = 'ITERATIVE' | 'RECURSIVE';
11
4
 
12
5
  export type FamilyPosition = 'ROOT' | 'LEFT' | 'RIGHT' | 'ROOT_LEFT' | 'ROOT_RIGHT' | 'ISOLATED' | 'MAL_NODE';
@@ -17,8 +10,6 @@ export type DFSOrderPattern = 'PRE' | 'IN' | 'POST';
17
10
 
18
11
  export type NodeDisplayLayout = [string[], number, number, number];
19
12
 
20
- export type BTNCallback<N, D = any> = (node: N) => D;
21
-
22
13
  export interface IterableWithSize<T> extends Iterable<T> {
23
14
  size: number | ((...args: any[]) => number);
24
15
  }
@@ -27,22 +18,8 @@ export interface IterableWithLength<T> extends Iterable<T> {
27
18
  length: number | ((...args: any[]) => number);
28
19
  }
29
20
 
30
- export type IterableWithSizeOrLength<T> = IterableWithSize<T> | IterableWithLength<T>;
31
-
32
- export type BinaryTreePrintOptions = { isShowUndefined?: boolean; isShowNull?: boolean; isShowRedBlackNIL?: boolean };
33
-
34
- export type BTNEntry<K, V> = [K | null | undefined, V | undefined];
35
-
36
- export type BTNKeyOrNode<K, N> = K | null | undefined | N;
21
+ export type OptValue<V> = V | undefined;
37
22
 
38
- export type KeyOrNodeOrEntry<K, V, N> = BTNEntry<K, V> | BTNKeyOrNode<K, N>;
39
-
40
- export type BTNodePureKeyOrNode<K, N> = K | N;
41
-
42
- export type BTNodePureExemplar<K, V, N> = [K, V | undefined] | BTNodePureKeyOrNode<K, N>;
43
-
44
- export type BSTNKeyOrNode<K, N> = K | undefined | N;
45
-
46
- export type BinaryTreeDeleteResult<N> = { deleted: N | null | undefined; needBalanced: N | null | undefined };
23
+ export type IterableWithSizeOrLength<T> = IterableWithSize<T> | IterableWithLength<T>;
47
24
 
48
25
  export type CRUD = 'CREATED' | 'READ' | 'UPDATED' | 'DELETED';
@@ -1,7 +1,7 @@
1
1
  import { IterableElementBase, IterableEntryBase } from '../../../data-structures';
2
2
 
3
3
  export type EntryCallback<K, V, R> = (value: V, key: K, index: number, container: IterableEntryBase<K, V>) => R;
4
- export type ElementCallback<V, R> = (element: V, index: number, container: IterableElementBase<V>) => R;
4
+ export type ElementCallback<E, R, RT, C> = (element: E, index: number, container: IterableElementBase<E, R, C>) => RT;
5
5
  export type ReduceEntryCallback<K, V, R> = (
6
6
  accumulator: R,
7
7
  value: V,
@@ -9,9 +9,17 @@ export type ReduceEntryCallback<K, V, R> = (
9
9
  index: number,
10
10
  container: IterableEntryBase<K, V>
11
11
  ) => R;
12
- export type ReduceElementCallback<V, R> = (
13
- accumulator: R,
14
- element: V,
12
+ export type ReduceElementCallback<E, R, RT, C> = (
13
+ accumulator: RT,
14
+ element: E,
15
15
  index: number,
16
- container: IterableElementBase<V>
17
- ) => R;
16
+ container: IterableElementBase<E, R, C>
17
+ ) => RT;
18
+
19
+ // export type IterableEntryBaseOptions<K, V, R> = {
20
+ // toEntryFn?: (rawElement: R) => BTNEntry<K, V>;
21
+ // };
22
+
23
+ export type IterableElementBaseOptions<E, R> = {
24
+ toElementFn?: (rawElement: R) => E;
25
+ };
@@ -1,9 +1,8 @@
1
1
  import { AVLTreeMultiMap, AVLTreeMultiMapNode } from '../../../data-structures';
2
2
  import type { AVLTreeOptions } from './avl-tree';
3
- import { Comparable } from "../../utils";
4
3
 
5
- 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>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
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, 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>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
6
5
 
7
- 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>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
6
+ export type AVLTreeMultiMapNested<K, V, R, NODE extends AVLTreeMultiMapNode<K, V, NODE>> = AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
8
7
 
9
- export type AVLTreeMultiMapOptions<K> = AVLTreeOptions<K> & {}
8
+ export type AVLTreeMultiMapOptions<K, V, R> = AVLTreeOptions<K, V, R> & {}