doubly-linked-list-typed 1.52.4 → 1.52.5
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-element-base.d.ts +1 -37
- package/dist/data-structures/base/iterable-element-base.js +1 -37
- package/dist/data-structures/base/iterable-entry-base.d.ts +2 -54
- package/dist/data-structures/base/iterable-entry-base.js +1 -49
- package/dist/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -32
- package/dist/data-structures/binary-tree/avl-tree-multi-map.js +9 -41
- package/dist/data-structures/binary-tree/avl-tree.d.ts +0 -46
- package/dist/data-structures/binary-tree/avl-tree.js +0 -46
- package/dist/data-structures/binary-tree/binary-tree.d.ts +82 -147
- package/dist/data-structures/binary-tree/binary-tree.js +299 -331
- package/dist/data-structures/binary-tree/bst.d.ts +1 -40
- package/dist/data-structures/binary-tree/bst.js +12 -44
- package/dist/data-structures/binary-tree/rb-tree.d.ts +0 -48
- package/dist/data-structures/binary-tree/rb-tree.js +2 -50
- package/dist/data-structures/binary-tree/tree-multi-map.d.ts +0 -32
- package/dist/data-structures/binary-tree/tree-multi-map.js +9 -41
- package/dist/data-structures/graph/abstract-graph.d.ts +0 -75
- package/dist/data-structures/graph/abstract-graph.js +0 -75
- package/dist/data-structures/graph/directed-graph.d.ts +0 -98
- package/dist/data-structures/graph/directed-graph.js +0 -98
- package/dist/data-structures/graph/undirected-graph.d.ts +0 -50
- package/dist/data-structures/graph/undirected-graph.js +0 -50
- package/dist/data-structures/hash/hash-map.d.ts +5 -92
- package/dist/data-structures/hash/hash-map.js +27 -111
- package/dist/data-structures/heap/heap.d.ts +0 -32
- package/dist/data-structures/heap/heap.js +0 -32
- package/dist/data-structures/linked-list/doubly-linked-list.d.ts +5 -88
- package/dist/data-structures/linked-list/doubly-linked-list.js +5 -88
- package/dist/data-structures/linked-list/singly-linked-list.d.ts +1 -83
- package/dist/data-structures/linked-list/singly-linked-list.js +2 -84
- package/dist/data-structures/linked-list/skip-linked-list.d.ts +1 -35
- package/dist/data-structures/linked-list/skip-linked-list.js +1 -35
- package/dist/data-structures/queue/deque.d.ts +1 -98
- package/dist/data-structures/queue/deque.js +3 -99
- package/dist/data-structures/queue/queue.d.ts +1 -54
- package/dist/data-structures/queue/queue.js +0 -53
- package/dist/data-structures/stack/stack.d.ts +1 -34
- package/dist/data-structures/stack/stack.js +1 -34
- package/dist/data-structures/tree/tree.js +2 -1
- package/dist/data-structures/trie/trie.d.ts +0 -64
- package/dist/data-structures/trie/trie.js +0 -64
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +8 -0
- package/dist/types/data-structures/binary-tree/binary-tree.js +6 -0
- package/dist/types/utils/utils.d.ts +13 -12
- package/dist/utils/number.d.ts +13 -0
- package/dist/utils/number.js +13 -0
- package/dist/utils/utils.d.ts +125 -3
- package/dist/utils/utils.js +177 -21
- package/package.json +2 -2
- package/src/data-structures/base/iterable-element-base.ts +2 -42
- package/src/data-structures/base/iterable-entry-base.ts +3 -62
- package/src/data-structures/binary-tree/avl-tree-multi-map.ts +8 -48
- package/src/data-structures/binary-tree/avl-tree.ts +0 -57
- package/src/data-structures/binary-tree/binary-tree.ts +329 -358
- package/src/data-structures/binary-tree/bst.ts +11 -54
- package/src/data-structures/binary-tree/rb-tree.ts +2 -62
- package/src/data-structures/binary-tree/tree-multi-map.ts +8 -48
- package/src/data-structures/graph/abstract-graph.ts +0 -92
- package/src/data-structures/graph/directed-graph.ts +0 -122
- package/src/data-structures/graph/undirected-graph.ts +0 -62
- package/src/data-structures/hash/hash-map.ts +29 -133
- package/src/data-structures/heap/heap.ts +0 -40
- package/src/data-structures/linked-list/doubly-linked-list.ts +5 -112
- package/src/data-structures/linked-list/singly-linked-list.ts +2 -104
- package/src/data-structures/linked-list/skip-linked-list.ts +1 -44
- package/src/data-structures/queue/deque.ts +2 -125
- package/src/data-structures/queue/queue.ts +1 -68
- package/src/data-structures/stack/stack.ts +1 -43
- package/src/data-structures/tree/tree.ts +1 -1
- package/src/data-structures/trie/trie.ts +0 -80
- package/src/types/data-structures/binary-tree/binary-tree.ts +8 -1
- package/src/types/utils/utils.ts +17 -15
- package/src/utils/number.ts +13 -0
- package/src/utils/utils.ts +174 -18
|
@@ -80,11 +80,6 @@ export declare class AVLTree<K = any, V = any, R = BTNEntry<K, V>, NODE extends
|
|
|
80
80
|
* an instance of the `AVLTreeNode` class.
|
|
81
81
|
*/
|
|
82
82
|
isNode(keyOrNodeOrEntryOrRawElement: R | BTNKeyOrNodeOrEntry<K, V, NODE>): keyOrNodeOrEntryOrRawElement is NODE;
|
|
83
|
-
/**
|
|
84
|
-
* Time Complexity: O(log n)
|
|
85
|
-
* Space Complexity: O(1)
|
|
86
|
-
* logarithmic time, where "n" is the number of nodes in the tree. The add method of the superclass (BST) has logarithmic time complexity. constant space, as it doesn't use additional data structures that scale with input size.
|
|
87
|
-
*/
|
|
88
83
|
/**
|
|
89
84
|
* Time Complexity: O(log n)
|
|
90
85
|
* Space Complexity: O(1)
|
|
@@ -99,10 +94,6 @@ export declare class AVLTree<K = any, V = any, R = BTNEntry<K, V>, NODE extends
|
|
|
99
94
|
* @returns The method is returning a boolean value.
|
|
100
95
|
*/
|
|
101
96
|
add(keyOrNodeOrEntryOrRawElement: R | BTNKeyOrNodeOrEntry<K, V, NODE>, value?: V): boolean;
|
|
102
|
-
/**
|
|
103
|
-
* Time Complexity: O(log n)
|
|
104
|
-
* Space Complexity: O(1)
|
|
105
|
-
*/
|
|
106
97
|
/**
|
|
107
98
|
* Time Complexity: O(log n)
|
|
108
99
|
* Space Complexity: O(1)
|
|
@@ -117,10 +108,6 @@ export declare class AVLTree<K = any, V = any, R = BTNEntry<K, V>, NODE extends
|
|
|
117
108
|
* @returns The method is returning an array of BinaryTreeDeleteResult<NODE> objects.
|
|
118
109
|
*/
|
|
119
110
|
delete<C extends BTNCallback<NODE>>(identifier: ReturnType<C>, callback?: C): BinaryTreeDeleteResult<NODE>[];
|
|
120
|
-
/**
|
|
121
|
-
* Time Complexity: O(1)
|
|
122
|
-
* Space Complexity: O(1)
|
|
123
|
-
*/
|
|
124
111
|
/**
|
|
125
112
|
* Time Complexity: O(1)
|
|
126
113
|
* Space Complexity: O(1)
|
|
@@ -135,10 +122,6 @@ export declare class AVLTree<K = any, V = any, R = BTNEntry<K, V>, NODE extends
|
|
|
135
122
|
* `destNodeEnsured` are truthy. Otherwise, it returns `undefined`.
|
|
136
123
|
*/
|
|
137
124
|
protected _swapProperties(srcNode: R | BSTNKeyOrNode<K, NODE>, destNode: R | BSTNKeyOrNode<K, NODE>): NODE | undefined;
|
|
138
|
-
/**
|
|
139
|
-
* Time Complexity: O(1)
|
|
140
|
-
* Space Complexity: O(1)
|
|
141
|
-
*/
|
|
142
125
|
/**
|
|
143
126
|
* Time Complexity: O(1)
|
|
144
127
|
* Space Complexity: O(1)
|
|
@@ -150,10 +133,6 @@ export declare class AVLTree<K = any, V = any, R = BTNEntry<K, V>, NODE extends
|
|
|
150
133
|
* height of the left subtree from the height of the right subtree.
|
|
151
134
|
*/
|
|
152
135
|
protected _balanceFactor(node: NODE): number;
|
|
153
|
-
/**
|
|
154
|
-
* Time Complexity: O(1)
|
|
155
|
-
* Space Complexity: O(1)
|
|
156
|
-
*/
|
|
157
136
|
/**
|
|
158
137
|
* Time Complexity: O(1)
|
|
159
138
|
* Space Complexity: O(1)
|
|
@@ -163,10 +142,6 @@ export declare class AVLTree<K = any, V = any, R = BTNEntry<K, V>, NODE extends
|
|
|
163
142
|
* @param {NODE} node - The parameter "node" represents a node in a binary tree data structure.
|
|
164
143
|
*/
|
|
165
144
|
protected _updateHeight(node: NODE): void;
|
|
166
|
-
/**
|
|
167
|
-
* Time Complexity: O(1)
|
|
168
|
-
* Space Complexity: O(1)
|
|
169
|
-
*/
|
|
170
145
|
/**
|
|
171
146
|
* Time Complexity: O(1)
|
|
172
147
|
* Space Complexity: O(1)
|
|
@@ -175,10 +150,6 @@ export declare class AVLTree<K = any, V = any, R = BTNEntry<K, V>, NODE extends
|
|
|
175
150
|
* @param {NODE} A - A is a node in a binary tree.
|
|
176
151
|
*/
|
|
177
152
|
protected _balanceLL(A: NODE): void;
|
|
178
|
-
/**
|
|
179
|
-
* Time Complexity: O(1)
|
|
180
|
-
* Space Complexity: O(1)
|
|
181
|
-
*/
|
|
182
153
|
/**
|
|
183
154
|
* Time Complexity: O(1)
|
|
184
155
|
* Space Complexity: O(1)
|
|
@@ -187,10 +158,6 @@ export declare class AVLTree<K = any, V = any, R = BTNEntry<K, V>, NODE extends
|
|
|
187
158
|
* @param {NODE} A - A is a node in a binary tree.
|
|
188
159
|
*/
|
|
189
160
|
protected _balanceLR(A: NODE): void;
|
|
190
|
-
/**
|
|
191
|
-
* Time Complexity: O(1)
|
|
192
|
-
* Space Complexity: O(1)
|
|
193
|
-
*/
|
|
194
161
|
/**
|
|
195
162
|
* Time Complexity: O(1)
|
|
196
163
|
* Space Complexity: O(1)
|
|
@@ -199,10 +166,6 @@ export declare class AVLTree<K = any, V = any, R = BTNEntry<K, V>, NODE extends
|
|
|
199
166
|
* @param {NODE} A - A is a node in a binary tree.
|
|
200
167
|
*/
|
|
201
168
|
protected _balanceRR(A: NODE): void;
|
|
202
|
-
/**
|
|
203
|
-
* Time Complexity: O(1)
|
|
204
|
-
* Space Complexity: O(1)
|
|
205
|
-
*/
|
|
206
169
|
/**
|
|
207
170
|
* Time Complexity: O(1)
|
|
208
171
|
* Space Complexity: O(1)
|
|
@@ -211,11 +174,6 @@ export declare class AVLTree<K = any, V = any, R = BTNEntry<K, V>, NODE extends
|
|
|
211
174
|
* @param {NODE} A - A is a node in a binary tree.
|
|
212
175
|
*/
|
|
213
176
|
protected _balanceRL(A: NODE): void;
|
|
214
|
-
/**
|
|
215
|
-
* Time Complexity: O(log n)
|
|
216
|
-
* Space Complexity: O(1)
|
|
217
|
-
* logarithmic time, where "n" is the number of nodes in the tree. The method traverses the path from the inserted node to the root. constant space, as it doesn't use additional data structures that scale with input size.
|
|
218
|
-
*/
|
|
219
177
|
/**
|
|
220
178
|
* Time Complexity: O(log n)
|
|
221
179
|
* Space Complexity: O(1)
|
|
@@ -226,10 +184,6 @@ export declare class AVLTree<K = any, V = any, R = BTNEntry<K, V>, NODE extends
|
|
|
226
184
|
* `BTNKeyOrNodeOrEntry<K, V, NODE>`.
|
|
227
185
|
*/
|
|
228
186
|
protected _balancePath(node: R | BTNKeyOrNodeOrEntry<K, V, NODE>): void;
|
|
229
|
-
/**
|
|
230
|
-
* Time Complexity: O(1)
|
|
231
|
-
* Space Complexity: O(1)
|
|
232
|
-
*/
|
|
233
187
|
/**
|
|
234
188
|
* Time Complexity: O(1)
|
|
235
189
|
* Space Complexity: O(1)
|
|
@@ -97,11 +97,6 @@ class AVLTree extends bst_1.BST {
|
|
|
97
97
|
isNode(keyOrNodeOrEntryOrRawElement) {
|
|
98
98
|
return keyOrNodeOrEntryOrRawElement instanceof AVLTreeNode;
|
|
99
99
|
}
|
|
100
|
-
/**
|
|
101
|
-
* Time Complexity: O(log n)
|
|
102
|
-
* Space Complexity: O(1)
|
|
103
|
-
* logarithmic time, where "n" is the number of nodes in the tree. The add method of the superclass (BST) has logarithmic time complexity. constant space, as it doesn't use additional data structures that scale with input size.
|
|
104
|
-
*/
|
|
105
100
|
/**
|
|
106
101
|
* Time Complexity: O(log n)
|
|
107
102
|
* Space Complexity: O(1)
|
|
@@ -123,10 +118,6 @@ class AVLTree extends bst_1.BST {
|
|
|
123
118
|
this._balancePath(keyOrNodeOrEntryOrRawElement);
|
|
124
119
|
return inserted;
|
|
125
120
|
}
|
|
126
|
-
/**
|
|
127
|
-
* Time Complexity: O(log n)
|
|
128
|
-
* Space Complexity: O(1)
|
|
129
|
-
*/
|
|
130
121
|
/**
|
|
131
122
|
* Time Complexity: O(log n)
|
|
132
123
|
* Space Complexity: O(1)
|
|
@@ -149,10 +140,6 @@ class AVLTree extends bst_1.BST {
|
|
|
149
140
|
}
|
|
150
141
|
return deletedResults;
|
|
151
142
|
}
|
|
152
|
-
/**
|
|
153
|
-
* Time Complexity: O(1)
|
|
154
|
-
* Space Complexity: O(1)
|
|
155
|
-
*/
|
|
156
143
|
/**
|
|
157
144
|
* Time Complexity: O(1)
|
|
158
145
|
* Space Complexity: O(1)
|
|
@@ -185,10 +172,6 @@ class AVLTree extends bst_1.BST {
|
|
|
185
172
|
}
|
|
186
173
|
return undefined;
|
|
187
174
|
}
|
|
188
|
-
/**
|
|
189
|
-
* Time Complexity: O(1)
|
|
190
|
-
* Space Complexity: O(1)
|
|
191
|
-
*/
|
|
192
175
|
/**
|
|
193
176
|
* Time Complexity: O(1)
|
|
194
177
|
* Space Complexity: O(1)
|
|
@@ -209,10 +192,6 @@ class AVLTree extends bst_1.BST {
|
|
|
209
192
|
else
|
|
210
193
|
return node.right.height - node.left.height;
|
|
211
194
|
}
|
|
212
|
-
/**
|
|
213
|
-
* Time Complexity: O(1)
|
|
214
|
-
* Space Complexity: O(1)
|
|
215
|
-
*/
|
|
216
195
|
/**
|
|
217
196
|
* Time Complexity: O(1)
|
|
218
197
|
* Space Complexity: O(1)
|
|
@@ -233,10 +212,6 @@ class AVLTree extends bst_1.BST {
|
|
|
233
212
|
else
|
|
234
213
|
node.height = 1 + Math.max(node.right.height, node.left.height);
|
|
235
214
|
}
|
|
236
|
-
/**
|
|
237
|
-
* Time Complexity: O(1)
|
|
238
|
-
* Space Complexity: O(1)
|
|
239
|
-
*/
|
|
240
215
|
/**
|
|
241
216
|
* Time Complexity: O(1)
|
|
242
217
|
* Space Complexity: O(1)
|
|
@@ -274,10 +249,6 @@ class AVLTree extends bst_1.BST {
|
|
|
274
249
|
if (B)
|
|
275
250
|
this._updateHeight(B);
|
|
276
251
|
}
|
|
277
|
-
/**
|
|
278
|
-
* Time Complexity: O(1)
|
|
279
|
-
* Space Complexity: O(1)
|
|
280
|
-
*/
|
|
281
252
|
/**
|
|
282
253
|
* Time Complexity: O(1)
|
|
283
254
|
* Space Complexity: O(1)
|
|
@@ -330,10 +301,6 @@ class AVLTree extends bst_1.BST {
|
|
|
330
301
|
B && this._updateHeight(B);
|
|
331
302
|
C && this._updateHeight(C);
|
|
332
303
|
}
|
|
333
|
-
/**
|
|
334
|
-
* Time Complexity: O(1)
|
|
335
|
-
* Space Complexity: O(1)
|
|
336
|
-
*/
|
|
337
304
|
/**
|
|
338
305
|
* Time Complexity: O(1)
|
|
339
306
|
* Space Complexity: O(1)
|
|
@@ -372,10 +339,6 @@ class AVLTree extends bst_1.BST {
|
|
|
372
339
|
this._updateHeight(A);
|
|
373
340
|
B && this._updateHeight(B);
|
|
374
341
|
}
|
|
375
|
-
/**
|
|
376
|
-
* Time Complexity: O(1)
|
|
377
|
-
* Space Complexity: O(1)
|
|
378
|
-
*/
|
|
379
342
|
/**
|
|
380
343
|
* Time Complexity: O(1)
|
|
381
344
|
* Space Complexity: O(1)
|
|
@@ -428,11 +391,6 @@ class AVLTree extends bst_1.BST {
|
|
|
428
391
|
B && this._updateHeight(B);
|
|
429
392
|
C && this._updateHeight(C);
|
|
430
393
|
}
|
|
431
|
-
/**
|
|
432
|
-
* Time Complexity: O(log n)
|
|
433
|
-
* Space Complexity: O(1)
|
|
434
|
-
* logarithmic time, where "n" is the number of nodes in the tree. The method traverses the path from the inserted node to the root. constant space, as it doesn't use additional data structures that scale with input size.
|
|
435
|
-
*/
|
|
436
394
|
/**
|
|
437
395
|
* Time Complexity: O(log n)
|
|
438
396
|
* Space Complexity: O(1)
|
|
@@ -482,10 +440,6 @@ class AVLTree extends bst_1.BST {
|
|
|
482
440
|
// TODO So far, no sure if this is necessary that Recursive Repair: Once rotation operations are executed, it may cause imbalance issues at higher levels of the tree. Therefore, you need to recursively check and repair imbalance problems upwards until you reach the root node.
|
|
483
441
|
}
|
|
484
442
|
}
|
|
485
|
-
/**
|
|
486
|
-
* Time Complexity: O(1)
|
|
487
|
-
* Space Complexity: O(1)
|
|
488
|
-
*/
|
|
489
443
|
/**
|
|
490
444
|
* Time Complexity: O(1)
|
|
491
445
|
* Space Complexity: O(1)
|