data-structure-typed 1.51.9 → 1.52.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 (186) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/README.md +13 -13
  3. package/benchmark/report.html +37 -1
  4. package/benchmark/report.json +385 -13
  5. package/dist/cjs/data-structures/base/index.d.ts +2 -1
  6. package/dist/cjs/data-structures/base/index.js +2 -1
  7. package/dist/cjs/data-structures/base/index.js.map +1 -1
  8. package/dist/cjs/data-structures/base/iterable-element-base.d.ts +171 -0
  9. package/dist/cjs/data-structures/base/iterable-element-base.js +226 -0
  10. package/dist/cjs/data-structures/base/iterable-element-base.js.map +1 -0
  11. package/dist/cjs/data-structures/base/{iterable-base.d.ts → iterable-entry-base.d.ts} +4 -147
  12. package/dist/cjs/data-structures/base/{iterable-base.js → iterable-entry-base.js} +13 -190
  13. package/dist/cjs/data-structures/base/iterable-entry-base.js.map +1 -0
  14. package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.d.ts +3 -3
  15. package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js.map +1 -1
  16. package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +3 -3
  17. package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -1
  18. package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +4 -4
  19. package/dist/cjs/data-structures/binary-tree/binary-tree.js +5 -3
  20. package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
  21. package/dist/cjs/data-structures/binary-tree/bst.d.ts +3 -11
  22. package/dist/cjs/data-structures/binary-tree/bst.js +2 -10
  23. package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
  24. package/dist/cjs/data-structures/binary-tree/rb-tree.d.ts +3 -3
  25. package/dist/cjs/data-structures/binary-tree/rb-tree.js.map +1 -1
  26. package/dist/cjs/data-structures/binary-tree/tree-multi-map.d.ts +3 -3
  27. package/dist/cjs/data-structures/binary-tree/tree-multi-map.js.map +1 -1
  28. package/dist/cjs/data-structures/hash/hash-map.d.ts +2 -2
  29. package/dist/cjs/data-structures/hash/hash-map.js.map +1 -1
  30. package/dist/cjs/data-structures/heap/heap.d.ts +43 -114
  31. package/dist/cjs/data-structures/heap/heap.js +59 -127
  32. package/dist/cjs/data-structures/heap/heap.js.map +1 -1
  33. package/dist/cjs/data-structures/heap/max-heap.d.ts +50 -4
  34. package/dist/cjs/data-structures/heap/max-heap.js +76 -10
  35. package/dist/cjs/data-structures/heap/max-heap.js.map +1 -1
  36. package/dist/cjs/data-structures/heap/min-heap.d.ts +51 -5
  37. package/dist/cjs/data-structures/heap/min-heap.js +68 -11
  38. package/dist/cjs/data-structures/heap/min-heap.js.map +1 -1
  39. package/dist/cjs/data-structures/linked-list/doubly-linked-list.d.ts +22 -28
  40. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js +26 -28
  41. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +1 -1
  42. package/dist/cjs/data-structures/linked-list/singly-linked-list.d.ts +22 -25
  43. package/dist/cjs/data-structures/linked-list/singly-linked-list.js +29 -26
  44. package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +1 -1
  45. package/dist/cjs/data-structures/priority-queue/max-priority-queue.d.ts +50 -4
  46. package/dist/cjs/data-structures/priority-queue/max-priority-queue.js +79 -10
  47. package/dist/cjs/data-structures/priority-queue/max-priority-queue.js.map +1 -1
  48. package/dist/cjs/data-structures/priority-queue/min-priority-queue.d.ts +51 -5
  49. package/dist/cjs/data-structures/priority-queue/min-priority-queue.js +71 -11
  50. package/dist/cjs/data-structures/priority-queue/min-priority-queue.js.map +1 -1
  51. package/dist/cjs/data-structures/priority-queue/priority-queue.d.ts +50 -4
  52. package/dist/cjs/data-structures/priority-queue/priority-queue.js +70 -1
  53. package/dist/cjs/data-structures/priority-queue/priority-queue.js.map +1 -1
  54. package/dist/cjs/data-structures/queue/deque.d.ts +20 -18
  55. package/dist/cjs/data-structures/queue/deque.js +27 -20
  56. package/dist/cjs/data-structures/queue/deque.js.map +1 -1
  57. package/dist/cjs/data-structures/queue/queue.d.ts +8 -28
  58. package/dist/cjs/data-structures/queue/queue.js +15 -31
  59. package/dist/cjs/data-structures/queue/queue.js.map +1 -1
  60. package/dist/cjs/data-structures/stack/stack.d.ts +17 -22
  61. package/dist/cjs/data-structures/stack/stack.js +25 -24
  62. package/dist/cjs/data-structures/stack/stack.js.map +1 -1
  63. package/dist/cjs/data-structures/trie/trie.d.ts +18 -13
  64. package/dist/cjs/data-structures/trie/trie.js +26 -15
  65. package/dist/cjs/data-structures/trie/trie.js.map +1 -1
  66. package/dist/cjs/interfaces/binary-tree.d.ts +2 -2
  67. package/dist/cjs/types/data-structures/base/base.d.ts +5 -2
  68. package/dist/cjs/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +2 -3
  69. package/dist/cjs/types/data-structures/binary-tree/avl-tree.d.ts +2 -3
  70. package/dist/cjs/types/data-structures/binary-tree/binary-tree.d.ts +2 -3
  71. package/dist/cjs/types/data-structures/binary-tree/bst.d.ts +2 -3
  72. package/dist/cjs/types/data-structures/binary-tree/rb-tree.d.ts +2 -3
  73. package/dist/cjs/types/data-structures/binary-tree/tree-multi-map.d.ts +2 -3
  74. package/dist/cjs/types/data-structures/heap/heap.d.ts +3 -2
  75. package/dist/cjs/types/data-structures/linked-list/doubly-linked-list.d.ts +2 -1
  76. package/dist/cjs/types/data-structures/linked-list/singly-linked-list.d.ts +2 -1
  77. package/dist/cjs/types/data-structures/priority-queue/priority-queue.d.ts +1 -1
  78. package/dist/cjs/types/data-structures/queue/deque.d.ts +3 -2
  79. package/dist/cjs/types/data-structures/queue/queue.d.ts +2 -1
  80. package/dist/cjs/types/data-structures/stack/stack.d.ts +2 -1
  81. package/dist/cjs/types/data-structures/trie/trie.d.ts +3 -2
  82. package/dist/mjs/data-structures/base/index.d.ts +2 -1
  83. package/dist/mjs/data-structures/base/index.js +2 -1
  84. package/dist/mjs/data-structures/base/iterable-element-base.d.ts +171 -0
  85. package/dist/mjs/data-structures/base/iterable-element-base.js +222 -0
  86. package/dist/mjs/data-structures/base/{iterable-base.d.ts → iterable-entry-base.d.ts} +4 -147
  87. package/dist/mjs/data-structures/base/{iterable-base.js → iterable-entry-base.js} +10 -186
  88. package/dist/mjs/data-structures/binary-tree/avl-tree-multi-map.d.ts +3 -3
  89. package/dist/mjs/data-structures/binary-tree/avl-tree.d.ts +3 -3
  90. package/dist/mjs/data-structures/binary-tree/binary-tree.d.ts +4 -4
  91. package/dist/mjs/data-structures/binary-tree/binary-tree.js +5 -3
  92. package/dist/mjs/data-structures/binary-tree/bst.d.ts +3 -11
  93. package/dist/mjs/data-structures/binary-tree/bst.js +2 -10
  94. package/dist/mjs/data-structures/binary-tree/rb-tree.d.ts +3 -3
  95. package/dist/mjs/data-structures/binary-tree/tree-multi-map.d.ts +3 -3
  96. package/dist/mjs/data-structures/hash/hash-map.d.ts +2 -2
  97. package/dist/mjs/data-structures/heap/heap.d.ts +43 -114
  98. package/dist/mjs/data-structures/heap/heap.js +60 -128
  99. package/dist/mjs/data-structures/heap/max-heap.d.ts +50 -4
  100. package/dist/mjs/data-structures/heap/max-heap.js +79 -10
  101. package/dist/mjs/data-structures/heap/min-heap.d.ts +51 -5
  102. package/dist/mjs/data-structures/heap/min-heap.js +68 -11
  103. package/dist/mjs/data-structures/linked-list/doubly-linked-list.d.ts +22 -28
  104. package/dist/mjs/data-structures/linked-list/doubly-linked-list.js +26 -28
  105. package/dist/mjs/data-structures/linked-list/singly-linked-list.d.ts +22 -25
  106. package/dist/mjs/data-structures/linked-list/singly-linked-list.js +29 -26
  107. package/dist/mjs/data-structures/priority-queue/max-priority-queue.d.ts +50 -4
  108. package/dist/mjs/data-structures/priority-queue/max-priority-queue.js +82 -10
  109. package/dist/mjs/data-structures/priority-queue/min-priority-queue.d.ts +51 -5
  110. package/dist/mjs/data-structures/priority-queue/min-priority-queue.js +71 -11
  111. package/dist/mjs/data-structures/priority-queue/priority-queue.d.ts +50 -4
  112. package/dist/mjs/data-structures/priority-queue/priority-queue.js +70 -1
  113. package/dist/mjs/data-structures/queue/deque.d.ts +20 -18
  114. package/dist/mjs/data-structures/queue/deque.js +27 -20
  115. package/dist/mjs/data-structures/queue/queue.d.ts +8 -28
  116. package/dist/mjs/data-structures/queue/queue.js +15 -31
  117. package/dist/mjs/data-structures/stack/stack.d.ts +17 -22
  118. package/dist/mjs/data-structures/stack/stack.js +25 -24
  119. package/dist/mjs/data-structures/trie/trie.d.ts +18 -13
  120. package/dist/mjs/data-structures/trie/trie.js +26 -15
  121. package/dist/mjs/interfaces/binary-tree.d.ts +2 -2
  122. package/dist/mjs/types/data-structures/base/base.d.ts +5 -2
  123. package/dist/mjs/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +2 -3
  124. package/dist/mjs/types/data-structures/binary-tree/avl-tree.d.ts +2 -3
  125. package/dist/mjs/types/data-structures/binary-tree/binary-tree.d.ts +2 -3
  126. package/dist/mjs/types/data-structures/binary-tree/bst.d.ts +2 -3
  127. package/dist/mjs/types/data-structures/binary-tree/rb-tree.d.ts +2 -3
  128. package/dist/mjs/types/data-structures/binary-tree/tree-multi-map.d.ts +2 -3
  129. package/dist/mjs/types/data-structures/heap/heap.d.ts +3 -2
  130. package/dist/mjs/types/data-structures/linked-list/doubly-linked-list.d.ts +2 -1
  131. package/dist/mjs/types/data-structures/linked-list/singly-linked-list.d.ts +2 -1
  132. package/dist/mjs/types/data-structures/priority-queue/priority-queue.d.ts +1 -1
  133. package/dist/mjs/types/data-structures/queue/deque.d.ts +3 -2
  134. package/dist/mjs/types/data-structures/queue/queue.d.ts +2 -1
  135. package/dist/mjs/types/data-structures/stack/stack.d.ts +2 -1
  136. package/dist/mjs/types/data-structures/trie/trie.d.ts +3 -2
  137. package/dist/umd/data-structure-typed.js +628 -319
  138. package/dist/umd/data-structure-typed.min.js +2 -2
  139. package/dist/umd/data-structure-typed.min.js.map +1 -1
  140. package/package.json +6 -6
  141. package/src/data-structures/base/index.ts +2 -1
  142. package/src/data-structures/base/iterable-element-base.ts +250 -0
  143. package/src/data-structures/base/{iterable-base.ts → iterable-entry-base.ts} +22 -213
  144. package/src/data-structures/binary-tree/avl-tree-multi-map.ts +2 -3
  145. package/src/data-structures/binary-tree/avl-tree.ts +2 -3
  146. package/src/data-structures/binary-tree/binary-tree.ts +6 -6
  147. package/src/data-structures/binary-tree/bst.ts +8 -19
  148. package/src/data-structures/binary-tree/rb-tree.ts +2 -3
  149. package/src/data-structures/binary-tree/tree-multi-map.ts +2 -3
  150. package/src/data-structures/hash/hash-map.ts +4 -4
  151. package/src/data-structures/heap/heap.ts +71 -152
  152. package/src/data-structures/heap/max-heap.ts +88 -13
  153. package/src/data-structures/heap/min-heap.ts +78 -15
  154. package/src/data-structures/linked-list/doubly-linked-list.ts +32 -32
  155. package/src/data-structures/linked-list/singly-linked-list.ts +37 -29
  156. package/src/data-structures/priority-queue/max-priority-queue.ts +94 -13
  157. package/src/data-structures/priority-queue/min-priority-queue.ts +84 -15
  158. package/src/data-structures/priority-queue/priority-queue.ts +81 -4
  159. package/src/data-structures/queue/deque.ts +35 -24
  160. package/src/data-structures/queue/queue.ts +23 -36
  161. package/src/data-structures/stack/stack.ts +31 -26
  162. package/src/data-structures/trie/trie.ts +33 -18
  163. package/src/interfaces/binary-tree.ts +1 -2
  164. package/src/types/data-structures/base/base.ts +14 -6
  165. package/src/types/data-structures/binary-tree/avl-tree-multi-map.ts +2 -3
  166. package/src/types/data-structures/binary-tree/avl-tree.ts +2 -3
  167. package/src/types/data-structures/binary-tree/binary-tree.ts +3 -4
  168. package/src/types/data-structures/binary-tree/bst.ts +2 -3
  169. package/src/types/data-structures/binary-tree/rb-tree.ts +2 -3
  170. package/src/types/data-structures/binary-tree/tree-multi-map.ts +2 -3
  171. package/src/types/data-structures/heap/heap.ts +4 -1
  172. package/src/types/data-structures/linked-list/doubly-linked-list.ts +3 -1
  173. package/src/types/data-structures/linked-list/singly-linked-list.ts +3 -1
  174. package/src/types/data-structures/priority-queue/priority-queue.ts +1 -1
  175. package/src/types/data-structures/queue/deque.ts +3 -1
  176. package/src/types/data-structures/queue/queue.ts +3 -1
  177. package/src/types/data-structures/stack/stack.ts +3 -1
  178. package/src/types/data-structures/trie/trie.ts +3 -1
  179. package/test/unit/data-structures/binary-tree/avl-tree-multi-map.test.ts +1 -1
  180. package/test/unit/data-structures/heap/heap.test.ts +80 -0
  181. package/test/unit/data-structures/heap/max-heap.test.ts +44 -1
  182. package/test/unit/data-structures/heap/min-heap.test.ts +18 -1
  183. package/test/unit/data-structures/priority-queue/max-priority-queue.test.ts +42 -0
  184. package/test/unit/data-structures/queue/deque.test.ts +30 -0
  185. package/test/unit/data-structures/queue/queue.test.ts +56 -0
  186. package/dist/cjs/data-structures/base/iterable-base.js.map +0 -1
@@ -10,17 +10,15 @@ import { SinglyLinkedList } from '../linked-list';
10
10
  * 7. Real-time Queuing: Like queuing systems in banks or supermarkets.
11
11
  */
12
12
  export class Queue extends IterableElementBase {
13
- /**
14
- * The constructor initializes an instance of a class with an optional array of elements and sets the offset to 0.
15
- * @param {E[]} [elements] - The `elements` parameter is an optional array of elements of type `E`. If provided, it
16
- * will be used to initialize the `_elements` property of the class. If not provided, the `_elements` property will be
17
- * initialized as an empty array.
18
- */
19
- constructor(elements = []) {
20
- super();
13
+ constructor(elements = [], options) {
14
+ super(options);
21
15
  if (elements) {
22
- for (const el of elements)
23
- this.push(el);
16
+ for (const el of elements) {
17
+ if (this.toElementFn)
18
+ this.push(this.toElementFn(el));
19
+ else
20
+ this.push(el);
21
+ }
24
22
  }
25
23
  }
26
24
  _elements = [];
@@ -164,7 +162,7 @@ export class Queue extends IterableElementBase {
164
162
  * @param index
165
163
  */
166
164
  at(index) {
167
- return this.elements[index];
165
+ return this.elements[index + this._offset];
168
166
  }
169
167
  /**
170
168
  * Time Complexity: O(1)
@@ -221,7 +219,7 @@ export class Queue extends IterableElementBase {
221
219
  * @returns The `clone()` method is returning a new instance of the `Queue` class.
222
220
  */
223
221
  clone() {
224
- return new Queue(this.elements.slice(this.offset));
222
+ return new Queue(this.elements.slice(this.offset), { toElementFn: this.toElementFn });
225
223
  }
226
224
  /**
227
225
  * Time Complexity: O(n)
@@ -244,7 +242,7 @@ export class Queue extends IterableElementBase {
244
242
  * satisfy the given predicate function.
245
243
  */
246
244
  filter(predicate, thisArg) {
247
- const newDeque = new Queue([]);
245
+ const newDeque = new Queue([], { toElementFn: this.toElementFn });
248
246
  let index = 0;
249
247
  for (const el of this) {
250
248
  if (predicate.call(thisArg, el, index, this)) {
@@ -258,22 +256,8 @@ export class Queue extends IterableElementBase {
258
256
  * Time Complexity: O(n)
259
257
  * Space Complexity: O(n)
260
258
  */
261
- /**
262
- * Time Complexity: O(n)
263
- * Space Complexity: O(n)
264
- *
265
- * The `map` function takes a callback function and applies it to each element in the queue,
266
- * returning a new queue with the results.
267
- * @param callback - The callback parameter is a function that will be called for each element in the
268
- * queue. It takes three arguments: the current element, the index of the current element, and the
269
- * queue itself. The callback function should return a new value that will be added to the new queue.
270
- * @param {any} [thisArg] - The `thisArg` parameter is an optional argument that specifies the value
271
- * to be used as `this` when executing the `callback` function. If `thisArg` is provided, it will be
272
- * passed as the `this` value to the `callback` function. If `thisArg` is
273
- * @returns The `map` function is returning a new `Queue` object with the transformed elements.
274
- */
275
- map(callback, thisArg) {
276
- const newDeque = new Queue([]);
259
+ map(callback, toElementFn, thisArg) {
260
+ const newDeque = new Queue([], { toElementFn });
277
261
  let index = 0;
278
262
  for (const el of this) {
279
263
  newDeque.push(callback.call(thisArg, el, index, this));
@@ -292,7 +276,7 @@ export class Queue extends IterableElementBase {
292
276
  * The function `_getIterator` returns an iterable iterator for the elements in the class.
293
277
  */
294
278
  *_getIterator() {
295
- for (const item of this.elements) {
279
+ for (const item of this.elements.slice(this.offset)) {
296
280
  yield item;
297
281
  }
298
282
  }
@@ -317,6 +301,6 @@ export class LinkedListQueue extends SinglyLinkedList {
317
301
  * values as the original `LinkedListQueue`.
318
302
  */
319
303
  clone() {
320
- return new LinkedListQueue(this.values());
304
+ return new LinkedListQueue(this, { toElementFn: this.toElementFn });
321
305
  }
322
306
  }
@@ -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
  * 1. Last In, First Out (LIFO): The core characteristic of a stack is its last in, first out nature, meaning the last element added to the stack will be the first to be removed.
@@ -15,14 +15,8 @@ import { IterableElementBase } from '../base';
15
15
  * 5. Expression Evaluation: Used for the evaluation of arithmetic or logical expressions, especially when dealing with parenthesis matching and operator precedence.
16
16
  * 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.
17
17
  */
18
- export declare class Stack<E = any> extends IterableElementBase<E> {
19
- /**
20
- * The constructor initializes an array of elements, which can be provided as an optional parameter.
21
- * @param {E[]} [elements] - The `elements` parameter is an optional parameter of type `E[]`, which represents an array
22
- * of elements of type `E`. It is used to initialize the `_elements` property of the class. If the `elements` parameter
23
- * is provided and is an array, it is assigned to the `_elements
24
- */
25
- constructor(elements?: Iterable<E>);
18
+ export declare class Stack<E = any, R = any> extends IterableElementBase<E, R, Stack<E, R>> {
19
+ constructor(elements?: Iterable<E> | Iterable<R>, options?: StackOptions<E, R>);
26
20
  protected _elements: E[];
27
21
  /**
28
22
  * The elements function returns the elements of this set.
@@ -137,7 +131,7 @@ export declare class Stack<E = any> extends IterableElementBase<E> {
137
131
  * The `clone()` function returns a new `Stack` object with the same elements as the original stack.
138
132
  * @returns The `clone()` method is returning a new `Stack` object with a copy of the `_elements` array.
139
133
  */
140
- clone(): Stack<E>;
134
+ clone(): Stack<E, R>;
141
135
  /**
142
136
  * Time Complexity: O(n)
143
137
  * Space Complexity: O(n)
@@ -158,25 +152,26 @@ export declare class Stack<E = any> extends IterableElementBase<E> {
158
152
  * @returns The `filter` method is returning a new `Stack` object that contains the elements that
159
153
  * satisfy the given predicate function.
160
154
  */
161
- filter(predicate: ElementCallback<E, boolean>, thisArg?: any): Stack<E>;
155
+ filter(predicate: ElementCallback<E, R, boolean, Stack<E, R>>, thisArg?: any): Stack<E, R>;
162
156
  /**
163
157
  * Time Complexity: O(n)
164
158
  * Space Complexity: O(n)
165
159
  */
166
160
  /**
167
- * Time Complexity: O(n)
168
- * Space Complexity: O(n)
169
- *
170
161
  * The `map` function takes a callback function and applies it to each element in the stack,
171
162
  * returning a new stack with the results.
172
- * @param callback - The `callback` parameter is a function that will be called for each element in
173
- * the stack. It takes three arguments:
174
- * @param {any} [thisArg] - The `thisArg` parameter is an optional argument that specifies the value
175
- * to be used as `this` when executing the `callback` function. If `thisArg` is provided, it will be
176
- * passed as the `this` value to the `callback` function. If `thisArg` is
177
- * @returns The `map` method is returning a new `Stack` object.
178
- */
179
- map<T>(callback: ElementCallback<E, T>, thisArg?: any): Stack<T>;
163
+ * @param callback - The callback parameter is a function that will be called for each element in the
164
+ * stack. It takes three arguments: the current element, the index of the element, and the stack
165
+ * itself. It should return a new value that will be added to the new stack.
166
+ * @param [toElementFn] - The `toElementFn` parameter is an optional function that can be used to
167
+ * transform the raw element (`RM`) into a new element (`EM`) before pushing it into the new stack.
168
+ * @param {any} [thisArg] - The `thisArg` parameter is an optional argument that allows you to
169
+ * specify the value of `this` within the callback function. It is used to set the context or scope
170
+ * in which the callback function will be executed. If `thisArg` is provided, it will be used as the
171
+ * value of
172
+ * @returns a new Stack object with elements of type EM and raw elements of type RM.
173
+ */
174
+ map<EM, RM>(callback: ElementCallback<E, R, EM, Stack<E, R>>, toElementFn?: (rawElement: RM) => EM, thisArg?: any): Stack<EM, RM>;
180
175
  /**
181
176
  * Time Complexity: O(n)
182
177
  * Space Complexity: O(n)
@@ -8,17 +8,17 @@ import { IterableElementBase } from '../base';
8
8
  * 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.
9
9
  */
10
10
  export class Stack extends IterableElementBase {
11
- /**
12
- * The constructor initializes an array of elements, which can be provided as an optional parameter.
13
- * @param {E[]} [elements] - The `elements` parameter is an optional parameter of type `E[]`, which represents an array
14
- * of elements of type `E`. It is used to initialize the `_elements` property of the class. If the `elements` parameter
15
- * is provided and is an array, it is assigned to the `_elements
16
- */
17
- constructor(elements = []) {
18
- super();
11
+ constructor(elements = [], options) {
12
+ super(options);
19
13
  if (elements) {
20
- for (const el of elements)
21
- this.push(el);
14
+ for (const el of elements) {
15
+ if (this.toElementFn) {
16
+ this.push(this.toElementFn(el));
17
+ }
18
+ else {
19
+ this.push(el);
20
+ }
21
+ }
22
22
  }
23
23
  }
24
24
  _elements = [];
@@ -165,7 +165,7 @@ export class Stack extends IterableElementBase {
165
165
  * @returns The `clone()` method is returning a new `Stack` object with a copy of the `_elements` array.
166
166
  */
167
167
  clone() {
168
- return new Stack(this.elements.slice());
168
+ return new Stack(this, { toElementFn: this.toElementFn });
169
169
  }
170
170
  /**
171
171
  * Time Complexity: O(n)
@@ -188,7 +188,7 @@ export class Stack extends IterableElementBase {
188
188
  * satisfy the given predicate function.
189
189
  */
190
190
  filter(predicate, thisArg) {
191
- const newStack = new Stack();
191
+ const newStack = new Stack([], { toElementFn: this.toElementFn });
192
192
  let index = 0;
193
193
  for (const el of this) {
194
194
  if (predicate.call(thisArg, el, index, this)) {
@@ -203,20 +203,21 @@ export class Stack extends IterableElementBase {
203
203
  * Space Complexity: O(n)
204
204
  */
205
205
  /**
206
- * Time Complexity: O(n)
207
- * Space Complexity: O(n)
208
- *
209
206
  * The `map` function takes a callback function and applies it to each element in the stack,
210
207
  * returning a new stack with the results.
211
- * @param callback - The `callback` parameter is a function that will be called for each element in
212
- * the stack. It takes three arguments:
213
- * @param {any} [thisArg] - The `thisArg` parameter is an optional argument that specifies the value
214
- * to be used as `this` when executing the `callback` function. If `thisArg` is provided, it will be
215
- * passed as the `this` value to the `callback` function. If `thisArg` is
216
- * @returns The `map` method is returning a new `Stack` object.
217
- */
218
- map(callback, thisArg) {
219
- const newStack = new Stack();
208
+ * @param callback - The callback parameter is a function that will be called for each element in the
209
+ * stack. It takes three arguments: the current element, the index of the element, and the stack
210
+ * itself. It should return a new value that will be added to the new stack.
211
+ * @param [toElementFn] - The `toElementFn` parameter is an optional function that can be used to
212
+ * transform the raw element (`RM`) into a new element (`EM`) before pushing it into the new stack.
213
+ * @param {any} [thisArg] - The `thisArg` parameter is an optional argument that allows you to
214
+ * specify the value of `this` within the callback function. It is used to set the context or scope
215
+ * in which the callback function will be executed. If `thisArg` is provided, it will be used as the
216
+ * value of
217
+ * @returns a new Stack object with elements of type EM and raw elements of type RM.
218
+ */
219
+ map(callback, toElementFn, thisArg) {
220
+ const newStack = new Stack([], { toElementFn });
220
221
  let index = 0;
221
222
  for (const el of this) {
222
223
  newStack.push(callback.call(thisArg, el, index, this));
@@ -66,14 +66,14 @@ export declare class TrieNode {
66
66
  * 10. IP Routing: Used in certain types of IP routing algorithms.
67
67
  * 11. Text Word Frequency Count: Counting and storing the frequency of words in a large amount of text data.
68
68
  */
69
- export declare class Trie extends IterableElementBase<string, Trie> {
69
+ export declare class Trie<R = any> extends IterableElementBase<string, R, Trie<R>> {
70
70
  /**
71
71
  * The constructor function for the Trie class.
72
72
  * @param words: Iterable string Initialize the trie with a set of words
73
73
  * @param options?: TrieOptions Allow the user to pass in options for the trie
74
74
  * @return This
75
75
  */
76
- constructor(words?: Iterable<string>, options?: TrieOptions);
76
+ constructor(words?: Iterable<string> | Iterable<R>, options?: TrieOptions<R>);
77
77
  protected _size: number;
78
78
  /**
79
79
  * The size function returns the size of the stack.
@@ -243,7 +243,7 @@ export declare class Trie extends IterableElementBase<string, Trie> {
243
243
  * sensitivity as the original Trie.
244
244
  * @returns A new instance of the Trie class is being returned.
245
245
  */
246
- clone(): Trie;
246
+ clone(): Trie<R>;
247
247
  /**
248
248
  * Time Complexity: O(n)
249
249
  * Space Complexity: O(n)
@@ -262,7 +262,7 @@ export declare class Trie extends IterableElementBase<string, Trie> {
262
262
  * specific object as the context for the `predicate` function. If `thisArg` is provided, it will be
263
263
  * @returns The `filter` method is returning an array of strings (`string[]`).
264
264
  */
265
- filter(predicate: ElementCallback<string, boolean>, thisArg?: any): Trie;
265
+ filter(predicate: ElementCallback<string, R, boolean, Trie<R>>, thisArg?: any): Trie<R>;
266
266
  /**
267
267
  * Time Complexity: O(n)
268
268
  * Space Complexity: O(n)
@@ -271,16 +271,21 @@ export declare class Trie extends IterableElementBase<string, Trie> {
271
271
  * Time Complexity: O(n)
272
272
  * Space Complexity: O(n)
273
273
  *
274
- * The `map` function creates a new Trie by applying a callback function to each element in the Trie.
274
+ * The `map` function creates a new Trie by applying a callback function to each element in the
275
+ * current Trie.
275
276
  * @param callback - The callback parameter is a function that will be called for each element in the
276
- * Trie. It takes three arguments: the current element in the Trie, the index of the current element,
277
- * and the Trie itself. The callback function should return a new value for the element.
278
- * @param {any} [thisArg] - The `thisArg` parameter is an optional argument that specifies the value
279
- * to be used as `this` when executing the `callback` function. If `thisArg` is provided, it will be
280
- * passed as the `this` value to the `callback` function. If `thisArg` is
281
- * @returns The `map` function is returning a new Trie object.
282
- */
283
- map(callback: ElementCallback<string, string>, thisArg?: any): Trie;
277
+ * Trie. It takes four arguments:
278
+ * @param [toElementFn] - The `toElementFn` parameter is an optional function that can be used to
279
+ * convert the raw element (`RM`) into a string representation. This can be useful if the raw element
280
+ * is not already a string or if you want to customize how the element is converted into a string. If
281
+ * this parameter is
282
+ * @param {any} [thisArg] - The `thisArg` parameter is an optional argument that allows you to
283
+ * specify the value of `this` within the callback function. It is used to set the context or scope
284
+ * in which the callback function will be executed. If `thisArg` is provided, it will be used as the
285
+ * value of
286
+ * @returns a new Trie object.
287
+ */
288
+ map<RM>(callback: ElementCallback<string, R, string, Trie<R>>, toElementFn?: (rawElement: RM) => string, thisArg?: any): Trie<RM>;
284
289
  /**
285
290
  * Time Complexity: O(n)
286
291
  * Space Complexity: O(n)
@@ -82,15 +82,21 @@ export class Trie extends IterableElementBase {
82
82
  * @return This
83
83
  */
84
84
  constructor(words = [], options) {
85
- super();
85
+ super(options);
86
86
  if (options) {
87
87
  const { caseSensitive } = options;
88
88
  if (caseSensitive !== undefined)
89
89
  this._caseSensitive = caseSensitive;
90
90
  }
91
91
  if (words) {
92
- for (const word of words)
93
- this.add(word);
92
+ for (const word of words) {
93
+ if (this.toElementFn) {
94
+ this.add(this.toElementFn(word));
95
+ }
96
+ else {
97
+ this.add(word);
98
+ }
99
+ }
94
100
  }
95
101
  }
96
102
  _size = 0;
@@ -432,7 +438,7 @@ export class Trie extends IterableElementBase {
432
438
  * @returns A new instance of the Trie class is being returned.
433
439
  */
434
440
  clone() {
435
- return new Trie(this.values(), { caseSensitive: this.caseSensitive });
441
+ return new Trie(this, { caseSensitive: this.caseSensitive, toElementFn: this.toElementFn });
436
442
  }
437
443
  /**
438
444
  * Time Complexity: O(n)
@@ -453,7 +459,7 @@ export class Trie extends IterableElementBase {
453
459
  * @returns The `filter` method is returning an array of strings (`string[]`).
454
460
  */
455
461
  filter(predicate, thisArg) {
456
- const results = new Trie();
462
+ const results = new Trie([], { toElementFn: this.toElementFn, caseSensitive: this.caseSensitive });
457
463
  let index = 0;
458
464
  for (const word of this) {
459
465
  if (predicate.call(thisArg, word, index, this)) {
@@ -471,17 +477,22 @@ export class Trie extends IterableElementBase {
471
477
  * Time Complexity: O(n)
472
478
  * Space Complexity: O(n)
473
479
  *
474
- * The `map` function creates a new Trie by applying a callback function to each element in the Trie.
480
+ * The `map` function creates a new Trie by applying a callback function to each element in the
481
+ * current Trie.
475
482
  * @param callback - The callback parameter is a function that will be called for each element in the
476
- * Trie. It takes three arguments: the current element in the Trie, the index of the current element,
477
- * and the Trie itself. The callback function should return a new value for the element.
478
- * @param {any} [thisArg] - The `thisArg` parameter is an optional argument that specifies the value
479
- * to be used as `this` when executing the `callback` function. If `thisArg` is provided, it will be
480
- * passed as the `this` value to the `callback` function. If `thisArg` is
481
- * @returns The `map` function is returning a new Trie object.
482
- */
483
- map(callback, thisArg) {
484
- const newTrie = new Trie();
483
+ * Trie. It takes four arguments:
484
+ * @param [toElementFn] - The `toElementFn` parameter is an optional function that can be used to
485
+ * convert the raw element (`RM`) into a string representation. This can be useful if the raw element
486
+ * is not already a string or if you want to customize how the element is converted into a string. If
487
+ * this parameter is
488
+ * @param {any} [thisArg] - The `thisArg` parameter is an optional argument that allows you to
489
+ * specify the value of `this` within the callback function. It is used to set the context or scope
490
+ * in which the callback function will be executed. If `thisArg` is provided, it will be used as the
491
+ * value of
492
+ * @returns a new Trie object.
493
+ */
494
+ map(callback, toElementFn, thisArg) {
495
+ const newTrie = new Trie([], { toElementFn, caseSensitive: this.caseSensitive });
485
496
  let index = 0;
486
497
  for (const word of this) {
487
498
  newTrie.add(callback.call(thisArg, word, index, this));
@@ -1,6 +1,6 @@
1
1
  import { BinaryTree, BinaryTreeNode } from '../data-structures';
2
- import type { BinaryTreeDeleteResult, BinaryTreeNested, BinaryTreeNodeNested, BinaryTreeOptions, BTNCallback, Comparable, KeyOrNodeOrEntry } from '../types';
3
- export interface IBinaryTree<K extends Comparable, V = any, R = [K, V], NODE extends BinaryTreeNode<K, V, NODE> = BinaryTreeNodeNested<K, V>, TREE extends BinaryTree<K, V, R, NODE, TREE> = BinaryTreeNested<K, V, R, NODE>> {
2
+ import type { BinaryTreeDeleteResult, BinaryTreeNested, BinaryTreeNodeNested, BinaryTreeOptions, BTNCallback, KeyOrNodeOrEntry } from '../types';
3
+ export interface IBinaryTree<K = any, V = any, R = [K, V], NODE extends BinaryTreeNode<K, V, NODE> = BinaryTreeNodeNested<K, V>, TREE extends BinaryTree<K, V, R, NODE, TREE> = BinaryTreeNested<K, V, R, NODE>> {
4
4
  createNode(key: K, value?: NODE['value']): NODE;
5
5
  createTree(options?: Partial<BinaryTreeOptions<K, V, R>>): TREE;
6
6
  add(keyOrNodeOrEntryOrRawElement: KeyOrNodeOrEntry<K, V, NODE>, value?: V, count?: number): boolean;
@@ -1,5 +1,8 @@
1
1
  import { IterableElementBase, IterableEntryBase } from '../../../data-structures';
2
2
  export type EntryCallback<K, V, R> = (value: V, key: K, index: number, container: IterableEntryBase<K, V>) => R;
3
- export type ElementCallback<V, R> = (element: V, index: number, container: IterableElementBase<V>) => R;
3
+ export type ElementCallback<E, R, RT, C> = (element: E, index: number, container: IterableElementBase<E, R, C>) => RT;
4
4
  export type ReduceEntryCallback<K, V, R> = (accumulator: R, value: V, key: K, index: number, container: IterableEntryBase<K, V>) => R;
5
- export type ReduceElementCallback<V, R> = (accumulator: R, element: V, index: number, container: IterableElementBase<V>) => R;
5
+ export type ReduceElementCallback<E, R, RT, C> = (accumulator: RT, element: E, index: number, container: IterableElementBase<E, R, C>) => RT;
6
+ export type IterableElementBaseOptions<E, R> = {
7
+ toElementFn?: (rawElement: R) => E;
8
+ };
@@ -1,6 +1,5 @@
1
1
  import { AVLTreeMultiMap, AVLTreeMultiMapNode } from '../../../data-structures';
2
2
  import type { AVLTreeOptions } from './avl-tree';
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, 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>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
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, 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>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
6
5
  export type AVLTreeMultiMapOptions<K, V, R> = AVLTreeOptions<K, V, R> & {};
@@ -1,6 +1,5 @@
1
1
  import { AVLTree, AVLTreeNode } from '../../../data-structures';
2
2
  import { BSTOptions } from './bst';
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, R, NODE extends AVLTreeNode<K, V, NODE>> = AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
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, R, NODE extends AVLTreeNode<K, V, NODE>> = AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
6
5
  export type AVLTreeOptions<K, V, R> = BSTOptions<K, V, R> & {};
@@ -1,8 +1,7 @@
1
1
  import { BinaryTree, BinaryTreeNode } from '../../../data-structures';
2
2
  import { BTNEntry, IterationType } from '../../common';
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, 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, 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>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
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, 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, 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>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
6
5
  export type BinaryTreeOptions<K, V, R> = {
7
6
  iterationType?: IterationType;
8
7
  toEntryFn?: (rawElement: R) => BTNEntry<K, V>;
@@ -1,9 +1,8 @@
1
1
  import { BST, BSTNode } from '../../../data-structures';
2
2
  import type { BinaryTreeOptions } from './binary-tree';
3
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, R, NODE extends BSTNode<K, V, NODE>> = BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
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, R, NODE extends BSTNode<K, V, NODE>> = BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
7
6
  export type BSTOptions<K, V, R> = BinaryTreeOptions<K, V, R> & {
8
7
  comparator?: Comparator<K>;
9
8
  };
@@ -1,7 +1,6 @@
1
1
  import { RedBlackTree, RedBlackTreeNode } from '../../../data-structures';
2
2
  import type { BSTOptions } from "./bst";
3
- import { Comparable } from "../../utils";
4
3
  export type RBTNColor = 'RED' | 'BLACK';
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, R, NODE extends RedBlackTreeNode<K, V, NODE>> = RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
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, R, NODE extends RedBlackTreeNode<K, V, NODE>> = RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
7
6
  export type RBTreeOptions<K, V, R> = BSTOptions<K, V, R> & {};
@@ -1,6 +1,5 @@
1
1
  import { TreeMultiMap, TreeMultiMapNode } from '../../../data-structures';
2
2
  import type { RBTreeOptions } from './rb-tree';
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, R, NODE extends TreeMultiMapNode<K, V, NODE>> = TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
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, R, NODE extends TreeMultiMapNode<K, V, NODE>> = TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
6
5
  export type TreeMultiMapOptions<K, V, R> = RBTreeOptions<K, V, R> & {};
@@ -1,4 +1,5 @@
1
1
  import { Comparator } from '../../common';
2
- export type HeapOptions<T> = {
3
- comparator?: Comparator<T>;
2
+ import { IterableElementBaseOptions } from '../base';
3
+ export type HeapOptions<E, R> = IterableElementBaseOptions<E, R> & {
4
+ comparator?: Comparator<E>;
4
5
  };
@@ -1 +1,2 @@
1
- export {};
1
+ import { IterableElementBaseOptions } from '../base';
2
+ export type DoublyLinkedListOptions<E, R> = IterableElementBaseOptions<E, R> & {};
@@ -1 +1,2 @@
1
- export {};
1
+ import { IterableElementBaseOptions } from '../base';
2
+ export type SinglyLinkedListOptions<E, R> = IterableElementBaseOptions<E, R> & {};
@@ -1,2 +1,2 @@
1
1
  import { HeapOptions } from '../heap';
2
- export type PriorityQueueOptions<T> = HeapOptions<T> & {};
2
+ export type PriorityQueueOptions<E, R> = HeapOptions<E, R> & {};
@@ -1,3 +1,4 @@
1
- export type DequeOptions = {
1
+ import { IterableElementBaseOptions } from '../base';
2
+ export type DequeOptions<E, R> = {
2
3
  bucketSize?: number;
3
- };
4
+ } & IterableElementBaseOptions<E, R>;
@@ -1 +1,2 @@
1
- export {};
1
+ import { IterableElementBaseOptions } from '../base';
2
+ export type QueueOptions<E, R> = IterableElementBaseOptions<E, R> & {};