min-heap-typed 1.50.1 → 1.50.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/data-structures/base/iterable-base.d.ts +120 -9
- package/dist/data-structures/base/iterable-base.js +143 -7
- package/dist/data-structures/binary-tree/avl-tree.d.ts +72 -47
- package/dist/data-structures/binary-tree/avl-tree.js +101 -72
- package/dist/data-structures/binary-tree/binary-indexed-tree.d.ts +22 -0
- package/dist/data-structures/binary-tree/binary-indexed-tree.js +22 -0
- package/dist/data-structures/binary-tree/binary-tree.d.ts +244 -199
- package/dist/data-structures/binary-tree/binary-tree.js +484 -376
- package/dist/data-structures/binary-tree/bst.d.ts +92 -79
- package/dist/data-structures/binary-tree/bst.js +68 -76
- package/dist/data-structures/binary-tree/rb-tree.d.ts +127 -57
- package/dist/data-structures/binary-tree/rb-tree.js +152 -99
- package/dist/data-structures/binary-tree/segment-tree.d.ts +99 -6
- package/dist/data-structures/binary-tree/segment-tree.js +127 -10
- package/dist/data-structures/binary-tree/tree-multimap.d.ts +72 -58
- package/dist/data-structures/binary-tree/tree-multimap.js +102 -85
- package/dist/data-structures/graph/abstract-graph.d.ts +1 -78
- package/dist/data-structures/graph/abstract-graph.js +3 -189
- package/dist/data-structures/graph/directed-graph.d.ts +73 -0
- package/dist/data-structures/graph/directed-graph.js +131 -0
- package/dist/data-structures/graph/map-graph.d.ts +8 -0
- package/dist/data-structures/graph/map-graph.js +14 -0
- package/dist/data-structures/graph/undirected-graph.d.ts +76 -7
- package/dist/data-structures/graph/undirected-graph.js +151 -18
- package/dist/data-structures/hash/hash-map.d.ts +254 -28
- package/dist/data-structures/hash/hash-map.js +347 -78
- package/dist/data-structures/heap/heap.d.ts +95 -25
- package/dist/data-structures/heap/heap.js +95 -26
- package/dist/data-structures/linked-list/doubly-linked-list.d.ts +126 -63
- package/dist/data-structures/linked-list/doubly-linked-list.js +141 -77
- package/dist/data-structures/linked-list/singly-linked-list.d.ts +154 -106
- package/dist/data-structures/linked-list/singly-linked-list.js +164 -115
- package/dist/data-structures/linked-list/skip-linked-list.d.ts +63 -36
- package/dist/data-structures/linked-list/skip-linked-list.js +63 -36
- package/dist/data-structures/matrix/matrix.d.ts +35 -4
- package/dist/data-structures/matrix/matrix.js +50 -11
- package/dist/data-structures/priority-queue/max-priority-queue.d.ts +10 -0
- package/dist/data-structures/priority-queue/max-priority-queue.js +10 -0
- package/dist/data-structures/priority-queue/min-priority-queue.d.ts +11 -0
- package/dist/data-structures/priority-queue/min-priority-queue.js +11 -0
- package/dist/data-structures/priority-queue/priority-queue.d.ts +8 -0
- package/dist/data-structures/priority-queue/priority-queue.js +8 -0
- package/dist/data-structures/queue/deque.d.ts +139 -35
- package/dist/data-structures/queue/deque.js +200 -62
- package/dist/data-structures/queue/queue.d.ts +103 -49
- package/dist/data-structures/queue/queue.js +111 -49
- package/dist/data-structures/stack/stack.d.ts +51 -21
- package/dist/data-structures/stack/stack.js +58 -22
- package/dist/data-structures/tree/tree.d.ts +57 -3
- package/dist/data-structures/tree/tree.js +77 -11
- package/dist/data-structures/trie/trie.d.ts +135 -34
- package/dist/data-structures/trie/trie.js +153 -33
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +1 -1
- package/dist/types/data-structures/hash/hash-map.d.ts +4 -3
- package/dist/types/utils/utils.d.ts +1 -0
- package/package.json +2 -2
- package/src/data-structures/base/iterable-base.ts +184 -19
- package/src/data-structures/binary-tree/avl-tree.ts +134 -100
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +22 -0
- package/src/data-structures/binary-tree/binary-tree.ts +674 -671
- package/src/data-structures/binary-tree/bst.ts +127 -136
- package/src/data-structures/binary-tree/rb-tree.ts +199 -166
- package/src/data-structures/binary-tree/segment-tree.ts +145 -11
- package/src/data-structures/binary-tree/tree-multimap.ts +138 -115
- package/src/data-structures/graph/abstract-graph.ts +4 -211
- package/src/data-structures/graph/directed-graph.ts +152 -0
- package/src/data-structures/graph/map-graph.ts +15 -0
- package/src/data-structures/graph/undirected-graph.ts +171 -19
- package/src/data-structures/hash/hash-map.ts +389 -96
- package/src/data-structures/heap/heap.ts +97 -26
- package/src/data-structures/linked-list/doubly-linked-list.ts +156 -83
- package/src/data-structures/linked-list/singly-linked-list.ts +174 -120
- package/src/data-structures/linked-list/skip-linked-list.ts +63 -37
- package/src/data-structures/matrix/matrix.ts +52 -12
- package/src/data-structures/priority-queue/max-priority-queue.ts +10 -0
- package/src/data-structures/priority-queue/min-priority-queue.ts +11 -0
- package/src/data-structures/priority-queue/priority-queue.ts +8 -0
- package/src/data-structures/queue/deque.ts +225 -70
- package/src/data-structures/queue/queue.ts +118 -49
- package/src/data-structures/stack/stack.ts +63 -23
- package/src/data-structures/tree/tree.ts +89 -15
- package/src/data-structures/trie/trie.ts +173 -38
- package/src/types/data-structures/binary-tree/binary-tree.ts +1 -1
- package/src/types/data-structures/hash/hash-map.ts +4 -3
- package/src/types/utils/utils.ts +2 -0
|
@@ -13,14 +13,70 @@ import { IterableElementBase } from '../base';
|
|
|
13
13
|
* and a flag indicating whether it's the end of a word.
|
|
14
14
|
*/
|
|
15
15
|
export class TrieNode {
|
|
16
|
-
key: string;
|
|
17
|
-
children: Map<string, TrieNode>;
|
|
18
|
-
isEnd: boolean;
|
|
19
|
-
|
|
20
16
|
constructor(key: string) {
|
|
21
|
-
this.
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
17
|
+
this._key = key;
|
|
18
|
+
this._isEnd = false;
|
|
19
|
+
this._children = new Map<string, TrieNode>();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
protected _key: string;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The function returns the value of the protected variable _key.
|
|
26
|
+
* @returns The value of the `_key` property, which is a string.
|
|
27
|
+
*/
|
|
28
|
+
get key(): string {
|
|
29
|
+
return this._key;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The above function sets the value of a protected variable called "key".
|
|
34
|
+
* @param {string} value - The value parameter is a string that represents the value to be assigned
|
|
35
|
+
* to the key.
|
|
36
|
+
*/
|
|
37
|
+
set key(value: string) {
|
|
38
|
+
this._key = value;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
protected _children: Map<string, TrieNode>;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The function returns the children of a TrieNode as a Map.
|
|
45
|
+
* @returns The `children` property of the TrieNode object, which is a Map containing string keys and
|
|
46
|
+
* TrieNode values.
|
|
47
|
+
*/
|
|
48
|
+
get children(): Map<string, TrieNode> {
|
|
49
|
+
return this._children;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The function sets the value of the `_children` property of a TrieNode object.
|
|
54
|
+
* @param value - The value parameter is a Map object that represents the children of a TrieNode. The
|
|
55
|
+
* keys of the map are strings, which represent the characters that are associated with each child
|
|
56
|
+
* TrieNode. The values of the map are TrieNode objects, which represent the child nodes of the
|
|
57
|
+
* current TrieNode.
|
|
58
|
+
*/
|
|
59
|
+
set children(value: Map<string, TrieNode>) {
|
|
60
|
+
this._children = value;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
protected _isEnd: boolean;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The function returns a boolean value indicating whether a certain condition is met.
|
|
67
|
+
* @returns The method is returning a boolean value, specifically the value of the variable `_isEnd`.
|
|
68
|
+
*/
|
|
69
|
+
get isEnd(): boolean {
|
|
70
|
+
return this._isEnd;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The function sets the value of the "_isEnd" property.
|
|
75
|
+
* @param {boolean} value - The value parameter is a boolean value that indicates whether the current
|
|
76
|
+
* state is the end state or not.
|
|
77
|
+
*/
|
|
78
|
+
set isEnd(value: boolean) {
|
|
79
|
+
this._isEnd = value;
|
|
24
80
|
}
|
|
25
81
|
}
|
|
26
82
|
|
|
@@ -37,7 +93,13 @@ export class TrieNode {
|
|
|
37
93
|
* 10. IP Routing: Used in certain types of IP routing algorithms.
|
|
38
94
|
* 11. Text Word Frequency Count: Counting and storing the frequency of words in a large amount of text data."
|
|
39
95
|
*/
|
|
40
|
-
export class Trie extends IterableElementBase<string> {
|
|
96
|
+
export class Trie extends IterableElementBase<string, Trie> {
|
|
97
|
+
/**
|
|
98
|
+
* The constructor function for the Trie class.
|
|
99
|
+
* @param words: Iterable string Initialize the trie with a set of words
|
|
100
|
+
* @param options?: TrieOptions Allow the user to pass in options for the trie
|
|
101
|
+
* @return This
|
|
102
|
+
*/
|
|
41
103
|
constructor(words: Iterable<string> = [], options?: TrieOptions) {
|
|
42
104
|
super();
|
|
43
105
|
if (options) {
|
|
@@ -51,30 +113,42 @@ export class Trie extends IterableElementBase<string> {
|
|
|
51
113
|
|
|
52
114
|
protected _size: number = 0;
|
|
53
115
|
|
|
116
|
+
/**
|
|
117
|
+
* The size function returns the size of the stack.
|
|
118
|
+
* @return The number of elements in the list
|
|
119
|
+
*/
|
|
54
120
|
get size(): number {
|
|
55
121
|
return this._size;
|
|
56
122
|
}
|
|
57
123
|
|
|
58
124
|
protected _caseSensitive: boolean = true;
|
|
59
125
|
|
|
126
|
+
/**
|
|
127
|
+
* The caseSensitive function is a getter that returns the value of the protected _caseSensitive property.
|
|
128
|
+
* @return The value of the _caseSensitive protected variable
|
|
129
|
+
*/
|
|
60
130
|
get caseSensitive(): boolean {
|
|
61
131
|
return this._caseSensitive;
|
|
62
132
|
}
|
|
63
133
|
|
|
64
134
|
protected _root: TrieNode = new TrieNode('');
|
|
65
135
|
|
|
136
|
+
/**
|
|
137
|
+
* The root function returns the root node of the tree.
|
|
138
|
+
* @return The root node
|
|
139
|
+
*/
|
|
66
140
|
get root() {
|
|
67
141
|
return this._root;
|
|
68
142
|
}
|
|
69
143
|
|
|
70
144
|
/**
|
|
71
|
-
* Time Complexity: O(
|
|
72
|
-
* Space Complexity: O(
|
|
145
|
+
* Time Complexity: O(l), where l is the length of the word being added.
|
|
146
|
+
* Space Complexity: O(l) - Each character in the word adds a TrieNode.
|
|
73
147
|
*/
|
|
74
148
|
|
|
75
149
|
/**
|
|
76
|
-
* Time Complexity: O(
|
|
77
|
-
* Space Complexity: O(
|
|
150
|
+
* Time Complexity: O(l), where l is the length of the word being added.
|
|
151
|
+
* Space Complexity: O(l) - Each character in the word adds a TrieNode.
|
|
78
152
|
*
|
|
79
153
|
* Add a word to the Trie structure.
|
|
80
154
|
* @param {string} word - The word to add.
|
|
@@ -101,12 +175,12 @@ export class Trie extends IterableElementBase<string> {
|
|
|
101
175
|
}
|
|
102
176
|
|
|
103
177
|
/**
|
|
104
|
-
* Time Complexity: O(
|
|
178
|
+
* Time Complexity: O(l), where l is the length of the input word.
|
|
105
179
|
* Space Complexity: O(1) - Constant space.
|
|
106
180
|
*/
|
|
107
181
|
|
|
108
182
|
/**
|
|
109
|
-
* Time Complexity: O(
|
|
183
|
+
* Time Complexity: O(l), where l is the length of the input word.
|
|
110
184
|
* Space Complexity: O(1) - Constant space.
|
|
111
185
|
*
|
|
112
186
|
* Check if the Trie contains a given word.
|
|
@@ -125,13 +199,45 @@ export class Trie extends IterableElementBase<string> {
|
|
|
125
199
|
}
|
|
126
200
|
|
|
127
201
|
/**
|
|
128
|
-
* Time Complexity: O(
|
|
129
|
-
* Space Complexity: O(
|
|
202
|
+
* Time Complexity: O(1)
|
|
203
|
+
* Space Complexity: O(1)
|
|
204
|
+
*/
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Time Complexity: O(1)
|
|
208
|
+
* Space Complexity: O(1)
|
|
209
|
+
*
|
|
210
|
+
* The isEmpty function checks if the size of the queue is 0.
|
|
211
|
+
* @return True if the size of the queue is 0
|
|
212
|
+
*/
|
|
213
|
+
isEmpty(): boolean {
|
|
214
|
+
return this.size === 0;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Time Complexity: O(1)
|
|
219
|
+
* Space Complexity: O(1)
|
|
130
220
|
*/
|
|
131
221
|
|
|
132
222
|
/**
|
|
133
|
-
* Time Complexity: O(
|
|
134
|
-
* Space Complexity: O(
|
|
223
|
+
* Time Complexity: O(1)
|
|
224
|
+
* Space Complexity: O(1)
|
|
225
|
+
*
|
|
226
|
+
* The clear function resets the size of the Trie to 0 and creates a new root TrieNode.
|
|
227
|
+
*/
|
|
228
|
+
clear(): void {
|
|
229
|
+
this._size = 0;
|
|
230
|
+
this._root = new TrieNode('');
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Time Complexity: O(l), where l is the length of the word being deleted.
|
|
235
|
+
* Space Complexity: O(n) - Due to the recursive DFS approach.
|
|
236
|
+
*/
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Time Complexity: O(l), where l is the length of the word being deleted.
|
|
240
|
+
* Space Complexity: O(n) - Due to the recursive DFS approach.
|
|
135
241
|
*
|
|
136
242
|
* Remove a word from the Trie structure.
|
|
137
243
|
* @param{string} word - The word to delete.
|
|
@@ -174,12 +280,12 @@ export class Trie extends IterableElementBase<string> {
|
|
|
174
280
|
}
|
|
175
281
|
|
|
176
282
|
/**
|
|
177
|
-
* Time Complexity: O(
|
|
283
|
+
* Time Complexity: O(n), where n is the total number of nodes in the trie.
|
|
178
284
|
* Space Complexity: O(1) - Constant space.
|
|
179
285
|
*/
|
|
180
286
|
|
|
181
287
|
/**
|
|
182
|
-
* Time Complexity: O(
|
|
288
|
+
* Time Complexity: O(n), where n is the total number of nodes in the trie.
|
|
183
289
|
* Space Complexity: O(1) - Constant space.
|
|
184
290
|
*
|
|
185
291
|
*/
|
|
@@ -204,12 +310,12 @@ export class Trie extends IterableElementBase<string> {
|
|
|
204
310
|
}
|
|
205
311
|
|
|
206
312
|
/**
|
|
207
|
-
* Time Complexity: O(
|
|
313
|
+
* Time Complexity: O(l), where l is the length of the input prefix.
|
|
208
314
|
* Space Complexity: O(1) - Constant space.
|
|
209
315
|
*/
|
|
210
316
|
|
|
211
317
|
/**
|
|
212
|
-
* Time Complexity: O(
|
|
318
|
+
* Time Complexity: O(l), where l is the length of the input prefix.
|
|
213
319
|
* Space Complexity: O(1) - Constant space.
|
|
214
320
|
*
|
|
215
321
|
* Check if a given input string has an absolute prefix in the Trie, meaning it's not a complete word.
|
|
@@ -228,12 +334,12 @@ export class Trie extends IterableElementBase<string> {
|
|
|
228
334
|
}
|
|
229
335
|
|
|
230
336
|
/**
|
|
231
|
-
* Time Complexity: O(
|
|
337
|
+
* Time Complexity: O(l), where l is the length of the input prefix.
|
|
232
338
|
* Space Complexity: O(1) - Constant space.
|
|
233
339
|
*/
|
|
234
340
|
|
|
235
341
|
/**
|
|
236
|
-
* Time Complexity: O(
|
|
342
|
+
* Time Complexity: O(l), where l is the length of the input prefix.
|
|
237
343
|
* Space Complexity: O(1) - Constant space.
|
|
238
344
|
*
|
|
239
345
|
* Check if a given input string is a prefix of any existing word in the Trie, whether as an absolute prefix or a complete word.
|
|
@@ -252,13 +358,13 @@ export class Trie extends IterableElementBase<string> {
|
|
|
252
358
|
}
|
|
253
359
|
|
|
254
360
|
/**
|
|
255
|
-
* Time Complexity: O(
|
|
256
|
-
* Space Complexity: O(
|
|
361
|
+
* Time Complexity: O(n), where n is the total number of nodes in the trie.
|
|
362
|
+
* Space Complexity: O(l), where l is the length of the input prefix.
|
|
257
363
|
*/
|
|
258
364
|
|
|
259
365
|
/**
|
|
260
|
-
* Time Complexity: O(
|
|
261
|
-
* Space Complexity: O(
|
|
366
|
+
* Time Complexity: O(n), where n is the total number of nodes in the trie.
|
|
367
|
+
* Space Complexity: O(l), where l is the length of the input prefix.
|
|
262
368
|
*
|
|
263
369
|
* Check if the input string is a common prefix in the Trie, meaning it's a prefix shared by all words in the Trie.
|
|
264
370
|
* @param {string} input - The input string representing the common prefix to check for.
|
|
@@ -279,13 +385,13 @@ export class Trie extends IterableElementBase<string> {
|
|
|
279
385
|
}
|
|
280
386
|
|
|
281
387
|
/**
|
|
282
|
-
* Time Complexity: O(
|
|
283
|
-
* Space Complexity: O(
|
|
388
|
+
* Time Complexity: O(n), where n is the total number of nodes in the trie.
|
|
389
|
+
* Space Complexity: O(l), where l is the length of the longest common prefix.
|
|
284
390
|
*/
|
|
285
391
|
|
|
286
392
|
/**
|
|
287
|
-
* Time Complexity: O(
|
|
288
|
-
* Space Complexity: O(
|
|
393
|
+
* Time Complexity: O(n), where n is the total number of nodes in the trie.
|
|
394
|
+
* Space Complexity: O(l), where l is the length of the longest common prefix.
|
|
289
395
|
*
|
|
290
396
|
* Get the longest common prefix among all the words stored in the Trie.
|
|
291
397
|
* @returns {string} The longest common prefix found in the Trie.
|
|
@@ -303,13 +409,13 @@ export class Trie extends IterableElementBase<string> {
|
|
|
303
409
|
}
|
|
304
410
|
|
|
305
411
|
/**
|
|
306
|
-
* Time Complexity: O(
|
|
307
|
-
* Space Complexity: O(
|
|
412
|
+
* Time Complexity: O(w * l), where w is the number of words retrieved, and l is the average length of the words.
|
|
413
|
+
* Space Complexity: O(w * l) - The space required for the output array.
|
|
308
414
|
*/
|
|
309
415
|
|
|
310
416
|
/**
|
|
311
|
-
* Time Complexity: O(
|
|
312
|
-
* Space Complexity: O(
|
|
417
|
+
* Time Complexity: O(w * l), where w is the number of words retrieved, and l is the average length of the words.
|
|
418
|
+
* Space Complexity: O(w * l) - The space required for the output array.
|
|
313
419
|
*
|
|
314
420
|
* The `getAll` function returns an array of all words in a Trie data structure that start with a given prefix.
|
|
315
421
|
* @param {string} prefix - The `prefix` parameter is a string that represents the prefix that we want to search for in the
|
|
@@ -351,6 +457,23 @@ export class Trie extends IterableElementBase<string> {
|
|
|
351
457
|
return words;
|
|
352
458
|
}
|
|
353
459
|
|
|
460
|
+
/**
|
|
461
|
+
* Time Complexity: O(n)
|
|
462
|
+
* Space Complexity: O(n)
|
|
463
|
+
*/
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* Time Complexity: O(n)
|
|
467
|
+
* Space Complexity: O(n)
|
|
468
|
+
*
|
|
469
|
+
* The `clone` function returns a new instance of the Trie class with the same values and case
|
|
470
|
+
* sensitivity as the original Trie.
|
|
471
|
+
* @returns A new instance of the Trie class is being returned.
|
|
472
|
+
*/
|
|
473
|
+
clone(): Trie {
|
|
474
|
+
return new Trie(this.values(), { caseSensitive: this.caseSensitive });
|
|
475
|
+
}
|
|
476
|
+
|
|
354
477
|
/**
|
|
355
478
|
* Time Complexity: O(n)
|
|
356
479
|
* Space Complexity: O(n)
|
|
@@ -410,6 +533,18 @@ export class Trie extends IterableElementBase<string> {
|
|
|
410
533
|
return newTrie;
|
|
411
534
|
}
|
|
412
535
|
|
|
536
|
+
/**
|
|
537
|
+
* Time Complexity: O(n)
|
|
538
|
+
* Space Complexity: O(n)
|
|
539
|
+
*/
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* Time Complexity: O(n)
|
|
543
|
+
* Space Complexity: O(n)
|
|
544
|
+
*
|
|
545
|
+
* The function `_getIterator` returns an iterable iterator that performs a depth-first search on a
|
|
546
|
+
* trie data structure and yields all the paths to the end nodes.
|
|
547
|
+
*/
|
|
413
548
|
protected* _getIterator(): IterableIterator<string> {
|
|
414
549
|
function* _dfs(node: TrieNode, path: string): IterableIterator<string> {
|
|
415
550
|
if (node.isEnd) {
|
|
@@ -424,12 +559,12 @@ export class Trie extends IterableElementBase<string> {
|
|
|
424
559
|
}
|
|
425
560
|
|
|
426
561
|
/**
|
|
427
|
-
* Time Complexity: O(
|
|
562
|
+
* Time Complexity: O(l), where l is the length of the input string.
|
|
428
563
|
* Space Complexity: O(1) - Constant space.
|
|
429
564
|
*/
|
|
430
565
|
|
|
431
566
|
/**
|
|
432
|
-
* Time Complexity: O(
|
|
567
|
+
* Time Complexity: O(l), where l is the length of the input string.
|
|
433
568
|
* Space Complexity: O(1) - Constant space.
|
|
434
569
|
*
|
|
435
570
|
* @param str
|
|
@@ -3,7 +3,7 @@ import { IterationType } from "../../common";
|
|
|
3
3
|
|
|
4
4
|
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>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
5
5
|
|
|
6
|
-
export type BinaryTreeNested<K, V,
|
|
6
|
+
export type BinaryTreeNested<K, V, NODE extends BinaryTreeNode<K, V, NODE>> = BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, BinaryTree<K, V, NODE, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
7
7
|
|
|
8
8
|
export type BinaryTreeOptions<K> = {
|
|
9
9
|
iterationType?: IterationType,
|
|
@@ -5,14 +5,15 @@ export type HashMapLinkedNode<K, V> = {
|
|
|
5
5
|
prev: HashMapLinkedNode<K, V>;
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
export type LinkedHashMapOptions<K> = {
|
|
8
|
+
export type LinkedHashMapOptions<K, V, R> = {
|
|
9
9
|
hashFn?: (key: K) => string;
|
|
10
10
|
objHashFn?: (key: K) => object;
|
|
11
|
+
toEntryFn?: (rawElement: R) => [K, V];
|
|
11
12
|
};
|
|
12
13
|
|
|
13
|
-
export type HashMapOptions<K, V,
|
|
14
|
+
export type HashMapOptions<K, V, R> = {
|
|
14
15
|
hashFn?: (key: K) => string;
|
|
15
|
-
toEntryFn?: (rawElement:
|
|
16
|
+
toEntryFn?: (rawElement: R) => [K, V];
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
export type HashMapStoreItem<K, V> = { key: K; value: V };
|
package/src/types/utils/utils.ts
CHANGED