data-structure-typed 1.52.4 → 1.52.6
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/CHANGELOG.md +1 -1
- package/README.md +13 -13
- package/README_zh-CN.md +216 -26
- package/benchmark/report.html +13 -13
- package/benchmark/report.json +158 -158
- package/dist/cjs/data-structures/base/iterable-element-base.d.ts +1 -37
- package/dist/cjs/data-structures/base/iterable-element-base.js +1 -37
- package/dist/cjs/data-structures/base/iterable-element-base.js.map +1 -1
- package/dist/cjs/data-structures/base/iterable-entry-base.d.ts +2 -54
- package/dist/cjs/data-structures/base/iterable-entry-base.js +1 -49
- package/dist/cjs/data-structures/base/iterable-entry-base.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -32
- package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js +9 -41
- package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +0 -46
- package/dist/cjs/data-structures/binary-tree/avl-tree.js +0 -46
- package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +82 -147
- package/dist/cjs/data-structures/binary-tree/binary-tree.js +300 -332
- package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/bst.d.ts +1 -40
- package/dist/cjs/data-structures/binary-tree/bst.js +12 -44
- package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/rb-tree.d.ts +0 -48
- package/dist/cjs/data-structures/binary-tree/rb-tree.js +2 -50
- package/dist/cjs/data-structures/binary-tree/rb-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/tree-multi-map.d.ts +0 -32
- package/dist/cjs/data-structures/binary-tree/tree-multi-map.js +9 -41
- package/dist/cjs/data-structures/binary-tree/tree-multi-map.js.map +1 -1
- package/dist/cjs/data-structures/graph/abstract-graph.d.ts +0 -75
- package/dist/cjs/data-structures/graph/abstract-graph.js +0 -75
- package/dist/cjs/data-structures/graph/abstract-graph.js.map +1 -1
- package/dist/cjs/data-structures/graph/directed-graph.d.ts +0 -98
- package/dist/cjs/data-structures/graph/directed-graph.js +0 -98
- package/dist/cjs/data-structures/graph/directed-graph.js.map +1 -1
- package/dist/cjs/data-structures/graph/undirected-graph.d.ts +0 -50
- package/dist/cjs/data-structures/graph/undirected-graph.js +0 -50
- package/dist/cjs/data-structures/graph/undirected-graph.js.map +1 -1
- package/dist/cjs/data-structures/hash/hash-map.d.ts +5 -92
- package/dist/cjs/data-structures/hash/hash-map.js +27 -111
- package/dist/cjs/data-structures/hash/hash-map.js.map +1 -1
- package/dist/cjs/data-structures/heap/heap.d.ts +0 -32
- package/dist/cjs/data-structures/heap/heap.js +0 -32
- package/dist/cjs/data-structures/heap/heap.js.map +1 -1
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.d.ts +5 -88
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.js +5 -88
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +1 -1
- package/dist/cjs/data-structures/linked-list/singly-linked-list.d.ts +1 -83
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js +2 -84
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +1 -1
- package/dist/cjs/data-structures/linked-list/skip-linked-list.d.ts +1 -35
- package/dist/cjs/data-structures/linked-list/skip-linked-list.js +1 -35
- package/dist/cjs/data-structures/linked-list/skip-linked-list.js.map +1 -1
- package/dist/cjs/data-structures/queue/deque.d.ts +1 -98
- package/dist/cjs/data-structures/queue/deque.js +3 -99
- package/dist/cjs/data-structures/queue/deque.js.map +1 -1
- package/dist/cjs/data-structures/queue/queue.d.ts +1 -54
- package/dist/cjs/data-structures/queue/queue.js +0 -53
- package/dist/cjs/data-structures/queue/queue.js.map +1 -1
- package/dist/cjs/data-structures/stack/stack.d.ts +1 -34
- package/dist/cjs/data-structures/stack/stack.js +1 -34
- package/dist/cjs/data-structures/stack/stack.js.map +1 -1
- package/dist/cjs/data-structures/tree/tree.js +2 -1
- package/dist/cjs/data-structures/tree/tree.js.map +1 -1
- package/dist/cjs/data-structures/trie/trie.d.ts +0 -64
- package/dist/cjs/data-structures/trie/trie.js +0 -64
- package/dist/cjs/data-structures/trie/trie.js.map +1 -1
- package/dist/cjs/types/data-structures/binary-tree/binary-tree.d.ts +8 -0
- package/dist/cjs/types/data-structures/binary-tree/binary-tree.js +6 -0
- package/dist/cjs/types/data-structures/binary-tree/binary-tree.js.map +1 -1
- package/dist/cjs/types/utils/utils.d.ts +13 -12
- package/dist/cjs/utils/number.d.ts +13 -0
- package/dist/cjs/utils/number.js +13 -0
- package/dist/cjs/utils/number.js.map +1 -1
- package/dist/cjs/utils/utils.d.ts +125 -3
- package/dist/cjs/utils/utils.js +177 -21
- package/dist/cjs/utils/utils.js.map +1 -1
- package/dist/mjs/data-structures/base/iterable-element-base.d.ts +1 -37
- package/dist/mjs/data-structures/base/iterable-element-base.js +1 -37
- package/dist/mjs/data-structures/base/iterable-entry-base.d.ts +2 -54
- package/dist/mjs/data-structures/base/iterable-entry-base.js +1 -49
- package/dist/mjs/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -32
- package/dist/mjs/data-structures/binary-tree/avl-tree-multi-map.js +9 -41
- package/dist/mjs/data-structures/binary-tree/avl-tree.d.ts +0 -46
- package/dist/mjs/data-structures/binary-tree/avl-tree.js +0 -46
- package/dist/mjs/data-structures/binary-tree/binary-tree.d.ts +82 -147
- package/dist/mjs/data-structures/binary-tree/binary-tree.js +299 -333
- package/dist/mjs/data-structures/binary-tree/bst.d.ts +1 -40
- package/dist/mjs/data-structures/binary-tree/bst.js +12 -44
- package/dist/mjs/data-structures/binary-tree/rb-tree.d.ts +0 -48
- package/dist/mjs/data-structures/binary-tree/rb-tree.js +2 -50
- package/dist/mjs/data-structures/binary-tree/tree-multi-map.d.ts +0 -32
- package/dist/mjs/data-structures/binary-tree/tree-multi-map.js +9 -41
- package/dist/mjs/data-structures/graph/abstract-graph.d.ts +0 -75
- package/dist/mjs/data-structures/graph/abstract-graph.js +0 -75
- package/dist/mjs/data-structures/graph/directed-graph.d.ts +0 -98
- package/dist/mjs/data-structures/graph/directed-graph.js +0 -98
- package/dist/mjs/data-structures/graph/undirected-graph.d.ts +0 -50
- package/dist/mjs/data-structures/graph/undirected-graph.js +0 -50
- package/dist/mjs/data-structures/hash/hash-map.d.ts +5 -92
- package/dist/mjs/data-structures/hash/hash-map.js +27 -111
- package/dist/mjs/data-structures/heap/heap.d.ts +0 -32
- package/dist/mjs/data-structures/heap/heap.js +0 -32
- package/dist/mjs/data-structures/linked-list/doubly-linked-list.d.ts +5 -88
- package/dist/mjs/data-structures/linked-list/doubly-linked-list.js +5 -88
- package/dist/mjs/data-structures/linked-list/singly-linked-list.d.ts +1 -83
- package/dist/mjs/data-structures/linked-list/singly-linked-list.js +2 -84
- package/dist/mjs/data-structures/linked-list/skip-linked-list.d.ts +1 -35
- package/dist/mjs/data-structures/linked-list/skip-linked-list.js +1 -35
- package/dist/mjs/data-structures/queue/deque.d.ts +1 -98
- package/dist/mjs/data-structures/queue/deque.js +3 -99
- package/dist/mjs/data-structures/queue/queue.d.ts +1 -54
- package/dist/mjs/data-structures/queue/queue.js +0 -53
- package/dist/mjs/data-structures/stack/stack.d.ts +1 -34
- package/dist/mjs/data-structures/stack/stack.js +1 -34
- package/dist/mjs/data-structures/tree/tree.js +2 -1
- package/dist/mjs/data-structures/trie/trie.d.ts +0 -64
- package/dist/mjs/data-structures/trie/trie.js +0 -64
- package/dist/mjs/types/data-structures/binary-tree/binary-tree.d.ts +8 -0
- package/dist/mjs/types/data-structures/binary-tree/binary-tree.js +5 -1
- package/dist/mjs/types/utils/utils.d.ts +13 -12
- package/dist/mjs/utils/number.d.ts +13 -0
- package/dist/mjs/utils/number.js +13 -0
- package/dist/mjs/utils/utils.d.ts +125 -3
- package/dist/mjs/utils/utils.js +177 -21
- package/dist/umd/data-structure-typed.js +411 -1475
- package/dist/umd/data-structure-typed.min.js +5 -4
- package/dist/umd/data-structure-typed.min.js.map +1 -1
- package/package.json +6 -6
- 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 +330 -359
- 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
- package/test/config.ts +8 -0
- package/test/integration/all-in-one.test.ts +1 -1
- package/test/integration/avl-tree.test.ts +1 -1
- package/test/integration/bst.test.ts +2 -2
- package/test/unit/data-structures/binary-tree/avl-tree-multi-map.test.ts +13 -13
- package/test/unit/data-structures/binary-tree/avl-tree.test.ts +18 -13
- package/test/unit/data-structures/binary-tree/binary-tree.test.ts +577 -167
- package/test/unit/data-structures/binary-tree/bst.test.ts +167 -23
- package/test/unit/data-structures/binary-tree/overall.test.ts +1 -1
- package/test/unit/data-structures/binary-tree/rb-tree.test.ts +136 -13
- package/test/unit/data-structures/binary-tree/tree-multi-map.test.ts +18 -13
- package/test/unit/data-structures/graph/directed-graph.test.ts +46 -32
- package/test/unit/data-structures/graph/map-graph.test.ts +24 -2
- package/test/unit/data-structures/graph/undirected-graph.test.ts +24 -24
- package/test/unit/data-structures/hash/hash-map.test.ts +225 -35
- package/test/unit/data-structures/heap/heap.test.ts +47 -39
- package/test/unit/data-structures/heap/min-heap.test.ts +5 -5
- package/test/unit/data-structures/linked-list/doubly-linked-list.test.ts +34 -4
- package/test/unit/data-structures/linked-list/singly-linked-list.test.ts +32 -0
- package/test/unit/data-structures/matrix/matrix.test.ts +35 -5
- package/test/unit/data-structures/priority-queue/max-priority-queue.test.ts +31 -0
- package/test/unit/data-structures/priority-queue/min-priority-queue.test.ts +18 -0
- package/test/unit/data-structures/priority-queue/priority-queue.test.ts +17 -0
- package/test/unit/data-structures/queue/deque.test.ts +288 -47
- package/test/unit/data-structures/queue/queue.test.ts +62 -37
- package/test/unit/data-structures/stack/stack.test.ts +30 -5
- package/test/unit/data-structures/tree/tree.test.ts +58 -0
- package/test/unit/data-structures/trie/trie.test.ts +46 -5
- package/test/unit/utils/utils.test.ts +169 -0
|
@@ -114,6 +114,7 @@ export declare class BST<K = any, V = any, R = BTNEntry<K, V>, NODE extends BSTN
|
|
|
114
114
|
* an instance of the `BSTNode` class.
|
|
115
115
|
*/
|
|
116
116
|
isNode(keyOrNodeOrEntryOrRawElement: R | BTNKeyOrNodeOrEntry<K, V, NODE>): keyOrNodeOrEntryOrRawElement is NODE;
|
|
117
|
+
isKey(key: any): key is K;
|
|
117
118
|
/**
|
|
118
119
|
* Time Complexity: O(log n)
|
|
119
120
|
* Space Complexity: O(1)
|
|
@@ -126,10 +127,6 @@ export declare class BST<K = any, V = any, R = BTNEntry<K, V>, NODE extends BSTN
|
|
|
126
127
|
* @returns a boolean value.
|
|
127
128
|
*/
|
|
128
129
|
add(keyOrNodeOrEntryOrRawElement: R | BTNKeyOrNodeOrEntry<K, V, NODE>, value?: V): boolean;
|
|
129
|
-
/**
|
|
130
|
-
* Time Complexity: O(log n)
|
|
131
|
-
* Space Complexity: O(log n)
|
|
132
|
-
*/
|
|
133
130
|
/**
|
|
134
131
|
* Time Complexity: O(k log n)
|
|
135
132
|
* Space Complexity: O(k + log n)
|
|
@@ -175,10 +172,6 @@ export declare class BST<K = any, V = any, R = BTNEntry<K, V>, NODE extends BSTN
|
|
|
175
172
|
* @returns The method `getNodes` returns an array of `NODE` objects.
|
|
176
173
|
*/
|
|
177
174
|
getNodes<C extends BTNCallback<NODE>>(identifier: ReturnType<C> | undefined, callback?: C, onlyOne?: boolean, beginRoot?: R | BTNKeyOrNodeOrEntry<K, V, NODE>, iterationType?: IterationType): NODE[];
|
|
178
|
-
/**
|
|
179
|
-
* Time Complexity: O(log n)
|
|
180
|
-
* Space Complexity: O(1)
|
|
181
|
-
*/
|
|
182
175
|
/**
|
|
183
176
|
* Time Complexity: O(log n)
|
|
184
177
|
* Space Complexity: O(1)
|
|
@@ -201,10 +194,6 @@ export declare class BST<K = any, V = any, R = BTNEntry<K, V>, NODE extends BSTN
|
|
|
201
194
|
* @returns The method is returning a NODE object or undefined.
|
|
202
195
|
*/
|
|
203
196
|
getNode<C extends BTNCallback<NODE>>(identifier: ReturnType<C> | undefined, callback?: C, beginRoot?: R | BSTNKeyOrNode<K, NODE>, iterationType?: IterationType): OptBSTN<NODE>;
|
|
204
|
-
/**
|
|
205
|
-
* Time Complexity: O(k log n)
|
|
206
|
-
* Space Complexity: O(k + log n)
|
|
207
|
-
*/
|
|
208
197
|
/**
|
|
209
198
|
* Time Complexity: O(log n)
|
|
210
199
|
* Space Complexity: O(1)
|
|
@@ -219,10 +208,6 @@ export declare class BST<K = any, V = any, R = BTNEntry<K, V>, NODE extends BSTN
|
|
|
219
208
|
* @returns The method is returning a NODE object or undefined.
|
|
220
209
|
*/
|
|
221
210
|
getNodeByKey(key: K, iterationType?: IterationType): OptBSTN<NODE>;
|
|
222
|
-
/**
|
|
223
|
-
* Time Complexity: O(log n)
|
|
224
|
-
* Space Complexity: O(k + log n)
|
|
225
|
-
*/
|
|
226
211
|
/**
|
|
227
212
|
* Time complexity: O(n)
|
|
228
213
|
* Space complexity: O(n)
|
|
@@ -244,10 +229,6 @@ export declare class BST<K = any, V = any, R = BTNEntry<K, V>, NODE extends BSTN
|
|
|
244
229
|
* @returns The method is returning an array of the return type of the callback function.
|
|
245
230
|
*/
|
|
246
231
|
dfs<C extends BTNCallback<NODE>>(callback?: C, pattern?: DFSOrderPattern, beginRoot?: R | BTNKeyOrNodeOrEntry<K, V, NODE>, iterationType?: IterationType): ReturnType<C>[];
|
|
247
|
-
/**
|
|
248
|
-
* Time Complexity: O(log n)
|
|
249
|
-
* Space Complexity: O(1)
|
|
250
|
-
*/
|
|
251
232
|
/**
|
|
252
233
|
* Time complexity: O(n)
|
|
253
234
|
* Space complexity: O(n)
|
|
@@ -266,10 +247,6 @@ export declare class BST<K = any, V = any, R = BTNEntry<K, V>, NODE extends BSTN
|
|
|
266
247
|
* @returns an array of the return type of the callback function.
|
|
267
248
|
*/
|
|
268
249
|
bfs<C extends BTNCallback<NODE>>(callback?: C, beginRoot?: R | BTNKeyOrNodeOrEntry<K, V, NODE>, iterationType?: IterationType): ReturnType<C>[];
|
|
269
|
-
/**
|
|
270
|
-
* Time Complexity: O(log n)
|
|
271
|
-
* Space Complexity: O(1)
|
|
272
|
-
*/
|
|
273
250
|
/**
|
|
274
251
|
* Time complexity: O(n)
|
|
275
252
|
* Space complexity: O(n)
|
|
@@ -289,10 +266,6 @@ export declare class BST<K = any, V = any, R = BTNEntry<K, V>, NODE extends BSTN
|
|
|
289
266
|
* function.
|
|
290
267
|
*/
|
|
291
268
|
listLevels<C extends BTNCallback<NODE>>(callback?: C, beginRoot?: R | BTNKeyOrNodeOrEntry<K, V, NODE>, iterationType?: IterationType): ReturnType<C>[][];
|
|
292
|
-
/**
|
|
293
|
-
* Time complexity: O(n)
|
|
294
|
-
* Space complexity: O(n)
|
|
295
|
-
*/
|
|
296
269
|
/**
|
|
297
270
|
* Time complexity: O(n)
|
|
298
271
|
* Space complexity: O(n)
|
|
@@ -315,10 +288,6 @@ export declare class BST<K = any, V = any, R = BTNEntry<K, V>, NODE extends BSTN
|
|
|
315
288
|
* `ReturnType<C>`, which is the return type of the callback function passed as an argument.
|
|
316
289
|
*/
|
|
317
290
|
lesserOrGreaterTraverse<C extends BTNCallback<NODE>>(callback?: C, lesserOrGreater?: CP, targetNode?: R | BTNKeyOrNodeOrEntry<K, V, NODE>, iterationType?: IterationType): ReturnType<C>[];
|
|
318
|
-
/**
|
|
319
|
-
* Time complexity: O(n)
|
|
320
|
-
* Space complexity: O(n)
|
|
321
|
-
*/
|
|
322
291
|
/**
|
|
323
292
|
* Time complexity: O(n)
|
|
324
293
|
* Space complexity: O(n)
|
|
@@ -332,10 +301,6 @@ export declare class BST<K = any, V = any, R = BTNEntry<K, V>, NODE extends BSTN
|
|
|
332
301
|
* @returns The function `perfectlyBalance` returns a boolean value.
|
|
333
302
|
*/
|
|
334
303
|
perfectlyBalance(iterationType?: IterationType): boolean;
|
|
335
|
-
/**
|
|
336
|
-
* Time complexity: O(n)
|
|
337
|
-
* Space complexity: O(n)
|
|
338
|
-
*/
|
|
339
304
|
/**
|
|
340
305
|
* Time Complexity: O(n)
|
|
341
306
|
* Space Complexity: O(log n)
|
|
@@ -351,10 +316,6 @@ export declare class BST<K = any, V = any, R = BTNEntry<K, V>, NODE extends BSTN
|
|
|
351
316
|
isAVLBalanced(iterationType?: IterationType): boolean;
|
|
352
317
|
protected _DEFAULT_COMPARATOR: (a: K, b: K) => number;
|
|
353
318
|
protected _comparator: Comparator<K>;
|
|
354
|
-
/**
|
|
355
|
-
* Time Complexity: O(n)
|
|
356
|
-
* Space Complexity: O(log n)
|
|
357
|
-
*/
|
|
358
319
|
/**
|
|
359
320
|
* The function returns the value of the _comparator property.
|
|
360
321
|
* @returns The `_comparator` property is being returned.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BinaryTree, BinaryTreeNode } from './binary-tree';
|
|
2
2
|
import { Queue } from '../queue';
|
|
3
|
+
import { isComparable } from '../../utils';
|
|
3
4
|
export class BSTNode extends BinaryTreeNode {
|
|
4
5
|
parent;
|
|
5
6
|
constructor(key, value) {
|
|
@@ -136,7 +137,7 @@ export class BST extends BinaryTree {
|
|
|
136
137
|
* @returns The method is returning either the node that was ensured or `undefined` if the node could
|
|
137
138
|
* not be ensured.
|
|
138
139
|
*/
|
|
139
|
-
ensureNode(keyOrNodeOrEntryOrRawElement, iterationType =
|
|
140
|
+
ensureNode(keyOrNodeOrEntryOrRawElement, iterationType = this.iterationType) {
|
|
140
141
|
return super.ensureNode(keyOrNodeOrEntryOrRawElement, iterationType) ?? undefined;
|
|
141
142
|
}
|
|
142
143
|
/**
|
|
@@ -149,6 +150,9 @@ export class BST extends BinaryTree {
|
|
|
149
150
|
isNode(keyOrNodeOrEntryOrRawElement) {
|
|
150
151
|
return keyOrNodeOrEntryOrRawElement instanceof BSTNode;
|
|
151
152
|
}
|
|
153
|
+
isKey(key) {
|
|
154
|
+
return isComparable(key, this.comparator !== this._DEFAULT_COMPARATOR);
|
|
155
|
+
}
|
|
152
156
|
/**
|
|
153
157
|
* Time Complexity: O(log n)
|
|
154
158
|
* Space Complexity: O(1)
|
|
@@ -194,10 +198,6 @@ export class BST extends BinaryTree {
|
|
|
194
198
|
}
|
|
195
199
|
return false;
|
|
196
200
|
}
|
|
197
|
-
/**
|
|
198
|
-
* Time Complexity: O(log n)
|
|
199
|
-
* Space Complexity: O(log n)
|
|
200
|
-
*/
|
|
201
201
|
/**
|
|
202
202
|
* Time Complexity: O(k log n)
|
|
203
203
|
* Space Complexity: O(k + log n)
|
|
@@ -327,6 +327,10 @@ export class BST extends BinaryTree {
|
|
|
327
327
|
* @returns The method `getNodes` returns an array of `NODE` objects.
|
|
328
328
|
*/
|
|
329
329
|
getNodes(identifier, callback = this._DEFAULT_CALLBACK, onlyOne = false, beginRoot = this.root, iterationType = this.iterationType) {
|
|
330
|
+
if (identifier === undefined)
|
|
331
|
+
return [];
|
|
332
|
+
if (identifier === null)
|
|
333
|
+
return [];
|
|
330
334
|
beginRoot = this.ensureNode(beginRoot);
|
|
331
335
|
if (!beginRoot)
|
|
332
336
|
return [];
|
|
@@ -387,10 +391,6 @@ export class BST extends BinaryTree {
|
|
|
387
391
|
}
|
|
388
392
|
return ans;
|
|
389
393
|
}
|
|
390
|
-
/**
|
|
391
|
-
* Time Complexity: O(log n)
|
|
392
|
-
* Space Complexity: O(1)
|
|
393
|
-
*/
|
|
394
394
|
/**
|
|
395
395
|
* Time Complexity: O(log n)
|
|
396
396
|
* Space Complexity: O(1)
|
|
@@ -415,10 +415,6 @@ export class BST extends BinaryTree {
|
|
|
415
415
|
getNode(identifier, callback = this._DEFAULT_CALLBACK, beginRoot = this.root, iterationType = this.iterationType) {
|
|
416
416
|
return this.getNodes(identifier, callback, true, beginRoot, iterationType)[0] ?? undefined;
|
|
417
417
|
}
|
|
418
|
-
/**
|
|
419
|
-
* Time Complexity: O(k log n)
|
|
420
|
-
* Space Complexity: O(k + log n)
|
|
421
|
-
*/
|
|
422
418
|
/**
|
|
423
419
|
* Time Complexity: O(log n)
|
|
424
420
|
* Space Complexity: O(1)
|
|
@@ -432,13 +428,9 @@ export class BST extends BinaryTree {
|
|
|
432
428
|
* It has a default value of `'ITERATIVE'`.
|
|
433
429
|
* @returns The method is returning a NODE object or undefined.
|
|
434
430
|
*/
|
|
435
|
-
getNodeByKey(key, iterationType =
|
|
431
|
+
getNodeByKey(key, iterationType = this.iterationType) {
|
|
436
432
|
return this.getNode(key, this._DEFAULT_CALLBACK, this.root, iterationType);
|
|
437
433
|
}
|
|
438
|
-
/**
|
|
439
|
-
* Time Complexity: O(log n)
|
|
440
|
-
* Space Complexity: O(k + log n)
|
|
441
|
-
*/
|
|
442
434
|
/**
|
|
443
435
|
* Time complexity: O(n)
|
|
444
436
|
* Space complexity: O(n)
|
|
@@ -459,13 +451,9 @@ export class BST extends BinaryTree {
|
|
|
459
451
|
* following values:
|
|
460
452
|
* @returns The method is returning an array of the return type of the callback function.
|
|
461
453
|
*/
|
|
462
|
-
dfs(callback = this._DEFAULT_CALLBACK, pattern = 'IN', beginRoot = this.root, iterationType =
|
|
463
|
-
return super.dfs(callback, pattern, beginRoot, iterationType
|
|
454
|
+
dfs(callback = this._DEFAULT_CALLBACK, pattern = 'IN', beginRoot = this.root, iterationType = this.iterationType) {
|
|
455
|
+
return super.dfs(callback, pattern, beginRoot, iterationType);
|
|
464
456
|
}
|
|
465
|
-
/**
|
|
466
|
-
* Time Complexity: O(log n)
|
|
467
|
-
* Space Complexity: O(1)
|
|
468
|
-
*/
|
|
469
457
|
/**
|
|
470
458
|
* Time complexity: O(n)
|
|
471
459
|
* Space complexity: O(n)
|
|
@@ -486,10 +474,6 @@ export class BST extends BinaryTree {
|
|
|
486
474
|
bfs(callback = this._DEFAULT_CALLBACK, beginRoot = this.root, iterationType = this.iterationType) {
|
|
487
475
|
return super.bfs(callback, beginRoot, iterationType, false);
|
|
488
476
|
}
|
|
489
|
-
/**
|
|
490
|
-
* Time Complexity: O(log n)
|
|
491
|
-
* Space Complexity: O(1)
|
|
492
|
-
*/
|
|
493
477
|
/**
|
|
494
478
|
* Time complexity: O(n)
|
|
495
479
|
* Space complexity: O(n)
|
|
@@ -511,10 +495,6 @@ export class BST extends BinaryTree {
|
|
|
511
495
|
listLevels(callback = this._DEFAULT_CALLBACK, beginRoot = this.root, iterationType = this.iterationType) {
|
|
512
496
|
return super.listLevels(callback, beginRoot, iterationType, false);
|
|
513
497
|
}
|
|
514
|
-
/**
|
|
515
|
-
* Time complexity: O(n)
|
|
516
|
-
* Space complexity: O(n)
|
|
517
|
-
*/
|
|
518
498
|
/**
|
|
519
499
|
* Time complexity: O(n)
|
|
520
500
|
* Space complexity: O(n)
|
|
@@ -574,10 +554,6 @@ export class BST extends BinaryTree {
|
|
|
574
554
|
return ans;
|
|
575
555
|
}
|
|
576
556
|
}
|
|
577
|
-
/**
|
|
578
|
-
* Time complexity: O(n)
|
|
579
|
-
* Space complexity: O(n)
|
|
580
|
-
*/
|
|
581
557
|
/**
|
|
582
558
|
* Time complexity: O(n)
|
|
583
559
|
* Space complexity: O(n)
|
|
@@ -626,10 +602,6 @@ export class BST extends BinaryTree {
|
|
|
626
602
|
return true;
|
|
627
603
|
}
|
|
628
604
|
}
|
|
629
|
-
/**
|
|
630
|
-
* Time complexity: O(n)
|
|
631
|
-
* Space complexity: O(n)
|
|
632
|
-
*/
|
|
633
605
|
/**
|
|
634
606
|
* Time Complexity: O(n)
|
|
635
607
|
* Space Complexity: O(log n)
|
|
@@ -698,10 +670,6 @@ export class BST extends BinaryTree {
|
|
|
698
670
|
return 0;
|
|
699
671
|
};
|
|
700
672
|
_comparator = this._DEFAULT_COMPARATOR;
|
|
701
|
-
/**
|
|
702
|
-
* Time Complexity: O(n)
|
|
703
|
-
* Space Complexity: O(log n)
|
|
704
|
-
*/
|
|
705
673
|
/**
|
|
706
674
|
* The function returns the value of the _comparator property.
|
|
707
675
|
* @returns The `_comparator` property is being returned.
|
|
@@ -67,10 +67,6 @@ export declare class RedBlackTree<K = any, V = any, R = BTNEntry<K, V>, NODE ext
|
|
|
67
67
|
* @returns a new instance of a RedBlackTree object.
|
|
68
68
|
*/
|
|
69
69
|
createTree(options?: RBTreeOptions<K, V, R>): TREE;
|
|
70
|
-
/**
|
|
71
|
-
* Time Complexity: O(1)
|
|
72
|
-
* Space Complexity: O(1)
|
|
73
|
-
*/
|
|
74
70
|
/**
|
|
75
71
|
* Time Complexity: O(1)
|
|
76
72
|
* Space Complexity: O(1)
|
|
@@ -82,10 +78,6 @@ export declare class RedBlackTree<K = any, V = any, R = BTNEntry<K, V>, NODE ext
|
|
|
82
78
|
* an instance of the `RedBlackTreeNode` class.
|
|
83
79
|
*/
|
|
84
80
|
isNode(keyOrNodeOrEntryOrRawElement: R | BTNKeyOrNodeOrEntry<K, V, NODE>): keyOrNodeOrEntryOrRawElement is NODE;
|
|
85
|
-
/**
|
|
86
|
-
* Time Complexity: O(1)
|
|
87
|
-
* Space Complexity: O(1)
|
|
88
|
-
*/
|
|
89
81
|
/**
|
|
90
82
|
* Time Complexity: O(1)
|
|
91
83
|
* Space Complexity: O(1)
|
|
@@ -94,10 +86,6 @@ export declare class RedBlackTree<K = any, V = any, R = BTNEntry<K, V>, NODE ext
|
|
|
94
86
|
* size counter to zero.
|
|
95
87
|
*/
|
|
96
88
|
clear(): void;
|
|
97
|
-
/**
|
|
98
|
-
* Time Complexity: O(log n)
|
|
99
|
-
* Space Complexity: O(1)
|
|
100
|
-
*/
|
|
101
89
|
/**
|
|
102
90
|
* Time Complexity: O(log n)
|
|
103
91
|
* Space Complexity: O(1)
|
|
@@ -114,10 +102,6 @@ export declare class RedBlackTree<K = any, V = any, R = BTNEntry<K, V>, NODE ext
|
|
|
114
102
|
* returns true. If the node cannot be added or updated, the method returns false.
|
|
115
103
|
*/
|
|
116
104
|
add(keyOrNodeOrEntryOrRawElement: R | BTNKeyOrNodeOrEntry<K, V, NODE>, value?: V): boolean;
|
|
117
|
-
/**
|
|
118
|
-
* Time Complexity: O(log n)
|
|
119
|
-
* Space Complexity: O(1)
|
|
120
|
-
*/
|
|
121
105
|
/**
|
|
122
106
|
* Time Complexity: O(log n)
|
|
123
107
|
* Space Complexity: O(1)
|
|
@@ -135,10 +119,6 @@ export declare class RedBlackTree<K = any, V = any, R = BTNEntry<K, V>, NODE ext
|
|
|
135
119
|
* @returns an array of BinaryTreeDeleteResult<NODE> objects.
|
|
136
120
|
*/
|
|
137
121
|
delete<C extends BTNCallback<NODE>>(identifier: ReturnType<C> | null | undefined, callback?: C): BinaryTreeDeleteResult<NODE>[];
|
|
138
|
-
/**
|
|
139
|
-
* Time Complexity: O(1)
|
|
140
|
-
* Space Complexity: O(1)
|
|
141
|
-
*/
|
|
142
122
|
/**
|
|
143
123
|
* Time Complexity: O(1)
|
|
144
124
|
* Space Complexity: O(1)
|
|
@@ -148,10 +128,6 @@ export declare class RedBlackTree<K = any, V = any, R = BTNEntry<K, V>, NODE ext
|
|
|
148
128
|
* @param {NODE | undefined} v - v is a parameter of type NODE or undefined.
|
|
149
129
|
*/
|
|
150
130
|
protected _setRoot(v: NODE | undefined): void;
|
|
151
|
-
/**
|
|
152
|
-
* Time Complexity: O(1)
|
|
153
|
-
* Space Complexity: O(1)
|
|
154
|
-
*/
|
|
155
131
|
/**
|
|
156
132
|
* Time Complexity: O(1)
|
|
157
133
|
* Space Complexity: O(1)
|
|
@@ -165,10 +141,6 @@ export declare class RedBlackTree<K = any, V = any, R = BTNEntry<K, V>, NODE ext
|
|
|
165
141
|
* superclass, with the `oldNode` and `newNode` parameters.
|
|
166
142
|
*/
|
|
167
143
|
protected _replaceNode(oldNode: NODE, newNode: NODE): NODE;
|
|
168
|
-
/**
|
|
169
|
-
* Time Complexity: O(log n)
|
|
170
|
-
* Space Complexity: O(1)
|
|
171
|
-
*/
|
|
172
144
|
/**
|
|
173
145
|
* Time Complexity: O(log n)
|
|
174
146
|
* Space Complexity: O(1)
|
|
@@ -182,10 +154,6 @@ export declare class RedBlackTree<K = any, V = any, R = BTNEntry<K, V>, NODE ext
|
|
|
182
154
|
* was created and inserted into the tree.
|
|
183
155
|
*/
|
|
184
156
|
protected _insert(node: NODE): CRUD;
|
|
185
|
-
/**
|
|
186
|
-
* Time Complexity: O(1)
|
|
187
|
-
* Space Complexity: O(1)
|
|
188
|
-
*/
|
|
189
157
|
/**
|
|
190
158
|
* Time Complexity: O(1)
|
|
191
159
|
* Space Complexity: O(1)
|
|
@@ -196,10 +164,6 @@ export declare class RedBlackTree<K = any, V = any, R = BTNEntry<K, V>, NODE ext
|
|
|
196
164
|
* either be a `NODE` object or `undefined`.
|
|
197
165
|
*/
|
|
198
166
|
protected _transplant(u: NODE, v: NODE | undefined): void;
|
|
199
|
-
/**
|
|
200
|
-
* Time Complexity: O(log n)
|
|
201
|
-
* Space Complexity: O(1)
|
|
202
|
-
*/
|
|
203
167
|
/**
|
|
204
168
|
* Time Complexity: O(log n)
|
|
205
169
|
* Space Complexity: O(1)
|
|
@@ -209,10 +173,6 @@ export declare class RedBlackTree<K = any, V = any, R = BTNEntry<K, V>, NODE ext
|
|
|
209
173
|
* structure. It can either be a valid node or `undefined`.
|
|
210
174
|
*/
|
|
211
175
|
protected _insertFixup(z: NODE | undefined): void;
|
|
212
|
-
/**
|
|
213
|
-
* Time Complexity: O(log n)
|
|
214
|
-
* Space Complexity: O(1)
|
|
215
|
-
*/
|
|
216
176
|
/**
|
|
217
177
|
* Time Complexity: O(log n)
|
|
218
178
|
* Space Complexity: O(1)
|
|
@@ -225,10 +185,6 @@ export declare class RedBlackTree<K = any, V = any, R = BTNEntry<K, V>, NODE ext
|
|
|
225
185
|
* does not return anything.
|
|
226
186
|
*/
|
|
227
187
|
protected _deleteFixup(node: NODE | undefined): void;
|
|
228
|
-
/**
|
|
229
|
-
* Time Complexity: O(1)
|
|
230
|
-
* Space Complexity: O(1)
|
|
231
|
-
*/
|
|
232
188
|
/**
|
|
233
189
|
* Time Complexity: O(1)
|
|
234
190
|
* Space Complexity: O(1)
|
|
@@ -239,10 +195,6 @@ export declare class RedBlackTree<K = any, V = any, R = BTNEntry<K, V>, NODE ext
|
|
|
239
195
|
* @returns void, which means it does not return any value.
|
|
240
196
|
*/
|
|
241
197
|
protected _leftRotate(x: NODE | undefined): void;
|
|
242
|
-
/**
|
|
243
|
-
* Time Complexity: O(1)
|
|
244
|
-
* Space Complexity: O(1)
|
|
245
|
-
*/
|
|
246
198
|
/**
|
|
247
199
|
* Time Complexity: O(1)
|
|
248
200
|
* Space Complexity: O(1)
|
|
@@ -86,10 +86,6 @@ export class RedBlackTree extends BST {
|
|
|
86
86
|
...options
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
|
-
/**
|
|
90
|
-
* Time Complexity: O(1)
|
|
91
|
-
* Space Complexity: O(1)
|
|
92
|
-
*/
|
|
93
89
|
/**
|
|
94
90
|
* Time Complexity: O(1)
|
|
95
91
|
* Space Complexity: O(1)
|
|
@@ -125,7 +121,7 @@ export class RedBlackTree extends BST {
|
|
|
125
121
|
//
|
|
126
122
|
// if (this.toEntryFn) {
|
|
127
123
|
// const [key, entryValue] = this.toEntryFn(keyOrNodeOrEntryOrRawElement as R);
|
|
128
|
-
// if (key) return this.createNode(key, entryValue ?? value, 'RED');
|
|
124
|
+
// if (this.isKey(key)) return this.createNode(key, entryValue ?? value, 'RED');
|
|
129
125
|
// }
|
|
130
126
|
//
|
|
131
127
|
// if (this.isEntry(keyOrNodeOrEntryOrRawElement)) {
|
|
@@ -138,10 +134,6 @@ export class RedBlackTree extends BST {
|
|
|
138
134
|
//
|
|
139
135
|
// return ;
|
|
140
136
|
// }
|
|
141
|
-
/**
|
|
142
|
-
* Time Complexity: O(1)
|
|
143
|
-
* Space Complexity: O(1)
|
|
144
|
-
*/
|
|
145
137
|
/**
|
|
146
138
|
* Time Complexity: O(1)
|
|
147
139
|
* Space Complexity: O(1)
|
|
@@ -153,10 +145,6 @@ export class RedBlackTree extends BST {
|
|
|
153
145
|
super.clear();
|
|
154
146
|
this._root = this.NIL;
|
|
155
147
|
}
|
|
156
|
-
/**
|
|
157
|
-
* Time Complexity: O(log n)
|
|
158
|
-
* Space Complexity: O(1)
|
|
159
|
-
*/
|
|
160
148
|
/**
|
|
161
149
|
* Time Complexity: O(log n)
|
|
162
150
|
* Space Complexity: O(1)
|
|
@@ -191,10 +179,6 @@ export class RedBlackTree extends BST {
|
|
|
191
179
|
else
|
|
192
180
|
return insertStatus === 'UPDATED';
|
|
193
181
|
}
|
|
194
|
-
/**
|
|
195
|
-
* Time Complexity: O(log n)
|
|
196
|
-
* Space Complexity: O(1)
|
|
197
|
-
*/
|
|
198
182
|
/**
|
|
199
183
|
* Time Complexity: O(log n)
|
|
200
184
|
* Space Complexity: O(1)
|
|
@@ -231,7 +215,7 @@ export class RedBlackTree extends BST {
|
|
|
231
215
|
this._transplant(nodeToDelete, nodeToDelete.left);
|
|
232
216
|
}
|
|
233
217
|
else {
|
|
234
|
-
const successor = this.getLeftMost(nodeToDelete.right);
|
|
218
|
+
const successor = this.getLeftMost(node => node, nodeToDelete.right);
|
|
235
219
|
if (successor) {
|
|
236
220
|
originalColor = successor.color;
|
|
237
221
|
replacementNode = successor.right;
|
|
@@ -263,10 +247,6 @@ export class RedBlackTree extends BST {
|
|
|
263
247
|
results.push({ deleted: nodeToDelete, needBalanced: undefined });
|
|
264
248
|
return results;
|
|
265
249
|
}
|
|
266
|
-
/**
|
|
267
|
-
* Time Complexity: O(1)
|
|
268
|
-
* Space Complexity: O(1)
|
|
269
|
-
*/
|
|
270
250
|
/**
|
|
271
251
|
* Time Complexity: O(1)
|
|
272
252
|
* Space Complexity: O(1)
|
|
@@ -281,10 +261,6 @@ export class RedBlackTree extends BST {
|
|
|
281
261
|
}
|
|
282
262
|
this._root = v;
|
|
283
263
|
}
|
|
284
|
-
/**
|
|
285
|
-
* Time Complexity: O(1)
|
|
286
|
-
* Space Complexity: O(1)
|
|
287
|
-
*/
|
|
288
264
|
/**
|
|
289
265
|
* Time Complexity: O(1)
|
|
290
266
|
* Space Complexity: O(1)
|
|
@@ -301,10 +277,6 @@ export class RedBlackTree extends BST {
|
|
|
301
277
|
newNode.color = oldNode.color;
|
|
302
278
|
return super._replaceNode(oldNode, newNode);
|
|
303
279
|
}
|
|
304
|
-
/**
|
|
305
|
-
* Time Complexity: O(log n)
|
|
306
|
-
* Space Complexity: O(1)
|
|
307
|
-
*/
|
|
308
280
|
/**
|
|
309
281
|
* Time Complexity: O(log n)
|
|
310
282
|
* Space Complexity: O(1)
|
|
@@ -350,10 +322,6 @@ export class RedBlackTree extends BST {
|
|
|
350
322
|
this._insertFixup(node);
|
|
351
323
|
return 'CREATED';
|
|
352
324
|
}
|
|
353
|
-
/**
|
|
354
|
-
* Time Complexity: O(1)
|
|
355
|
-
* Space Complexity: O(1)
|
|
356
|
-
*/
|
|
357
325
|
/**
|
|
358
326
|
* Time Complexity: O(1)
|
|
359
327
|
* Space Complexity: O(1)
|
|
@@ -377,10 +345,6 @@ export class RedBlackTree extends BST {
|
|
|
377
345
|
v.parent = u.parent;
|
|
378
346
|
}
|
|
379
347
|
}
|
|
380
|
-
/**
|
|
381
|
-
* Time Complexity: O(log n)
|
|
382
|
-
* Space Complexity: O(1)
|
|
383
|
-
*/
|
|
384
348
|
/**
|
|
385
349
|
* Time Complexity: O(log n)
|
|
386
350
|
* Space Complexity: O(1)
|
|
@@ -447,10 +411,6 @@ export class RedBlackTree extends BST {
|
|
|
447
411
|
if (this.isRealNode(this._root))
|
|
448
412
|
this._root.color = 'BLACK';
|
|
449
413
|
}
|
|
450
|
-
/**
|
|
451
|
-
* Time Complexity: O(log n)
|
|
452
|
-
* Space Complexity: O(1)
|
|
453
|
-
*/
|
|
454
414
|
/**
|
|
455
415
|
* Time Complexity: O(log n)
|
|
456
416
|
* Space Complexity: O(1)
|
|
@@ -537,10 +497,6 @@ export class RedBlackTree extends BST {
|
|
|
537
497
|
node.color = 'BLACK';
|
|
538
498
|
}
|
|
539
499
|
}
|
|
540
|
-
/**
|
|
541
|
-
* Time Complexity: O(1)
|
|
542
|
-
* Space Complexity: O(1)
|
|
543
|
-
*/
|
|
544
500
|
/**
|
|
545
501
|
* Time Complexity: O(1)
|
|
546
502
|
* Space Complexity: O(1)
|
|
@@ -572,10 +528,6 @@ export class RedBlackTree extends BST {
|
|
|
572
528
|
y.left = x;
|
|
573
529
|
x.parent = y;
|
|
574
530
|
}
|
|
575
|
-
/**
|
|
576
|
-
* Time Complexity: O(1)
|
|
577
|
-
* Space Complexity: O(1)
|
|
578
|
-
*/
|
|
579
531
|
/**
|
|
580
532
|
* Time Complexity: O(1)
|
|
581
533
|
* Space Complexity: O(1)
|
|
@@ -53,10 +53,6 @@ export declare class TreeMultiMap<K = any, V = any, R = BTNEntry<K, V>, NODE ext
|
|
|
53
53
|
* @returns the sum of the count property of all nodes in the tree.
|
|
54
54
|
*/
|
|
55
55
|
get count(): number;
|
|
56
|
-
/**
|
|
57
|
-
* Time Complexity: O(n)
|
|
58
|
-
* Space Complexity: O(1)
|
|
59
|
-
*/
|
|
60
56
|
/**
|
|
61
57
|
* Time Complexity: O(n)
|
|
62
58
|
* Space Complexity: O(1)
|
|
@@ -110,10 +106,6 @@ export declare class TreeMultiMap<K = any, V = any, R = BTNEntry<K, V>, NODE ext
|
|
|
110
106
|
* an instance of the `TreeMultiMapNode` class.
|
|
111
107
|
*/
|
|
112
108
|
isNode(keyOrNodeOrEntryOrRawElement: R | BTNKeyOrNodeOrEntry<K, V, NODE>): keyOrNodeOrEntryOrRawElement is NODE;
|
|
113
|
-
/**
|
|
114
|
-
* Time Complexity: O(log n)
|
|
115
|
-
* Space Complexity: O(1)
|
|
116
|
-
*/
|
|
117
109
|
/**
|
|
118
110
|
* Time Complexity: O(log n)
|
|
119
111
|
* Space Complexity: O(1)
|
|
@@ -131,10 +123,6 @@ export declare class TreeMultiMap<K = any, V = any, R = BTNEntry<K, V>, NODE ext
|
|
|
131
123
|
* was successful, and false otherwise.
|
|
132
124
|
*/
|
|
133
125
|
add(keyOrNodeOrEntryOrRawElement: R | BTNKeyOrNodeOrEntry<K, V, NODE>, value?: V, count?: number): boolean;
|
|
134
|
-
/**
|
|
135
|
-
* Time Complexity: O(log n)
|
|
136
|
-
* Space Complexity: O(1)
|
|
137
|
-
*/
|
|
138
126
|
/**
|
|
139
127
|
* Time Complexity: O(log n)
|
|
140
128
|
* Space Complexity: O(1)
|
|
@@ -154,10 +142,6 @@ export declare class TreeMultiMap<K = any, V = any, R = BTNEntry<K, V>, NODE ext
|
|
|
154
142
|
* @returns an array of BinaryTreeDeleteResult<NODE> objects.
|
|
155
143
|
*/
|
|
156
144
|
delete<C extends BTNCallback<NODE>>(identifier: ReturnType<C> | null | undefined, callback?: C, ignoreCount?: boolean): BinaryTreeDeleteResult<NODE>[];
|
|
157
|
-
/**
|
|
158
|
-
* Time Complexity: O(1)
|
|
159
|
-
* Space Complexity: O(1)
|
|
160
|
-
*/
|
|
161
145
|
/**
|
|
162
146
|
* Time Complexity: O(1)
|
|
163
147
|
* Space Complexity: O(1)
|
|
@@ -166,10 +150,6 @@ export declare class TreeMultiMap<K = any, V = any, R = BTNEntry<K, V>, NODE ext
|
|
|
166
150
|
* zero.
|
|
167
151
|
*/
|
|
168
152
|
clear(): void;
|
|
169
|
-
/**
|
|
170
|
-
* Time Complexity: O(n log n)
|
|
171
|
-
* Space Complexity: O(log n)
|
|
172
|
-
*/
|
|
173
153
|
/**
|
|
174
154
|
* Time Complexity: O(n log n)
|
|
175
155
|
* Space Complexity: O(log n)
|
|
@@ -184,10 +164,6 @@ export declare class TreeMultiMap<K = any, V = any, R = BTNEntry<K, V>, NODE ext
|
|
|
184
164
|
* balancing operation is successful, and `false` if there are no nodes to balance.
|
|
185
165
|
*/
|
|
186
166
|
perfectlyBalance(iterationType?: IterationType): boolean;
|
|
187
|
-
/**
|
|
188
|
-
* Time complexity: O(n)
|
|
189
|
-
* Space complexity: O(n)
|
|
190
|
-
*/
|
|
191
167
|
/**
|
|
192
168
|
* Time complexity: O(n)
|
|
193
169
|
* Space complexity: O(n)
|
|
@@ -196,10 +172,6 @@ export declare class TreeMultiMap<K = any, V = any, R = BTNEntry<K, V>, NODE ext
|
|
|
196
172
|
* @returns The `clone()` method is returning a cloned instance of the `TREE` object.
|
|
197
173
|
*/
|
|
198
174
|
clone(): TREE;
|
|
199
|
-
/**
|
|
200
|
-
* Time Complexity: O(1)
|
|
201
|
-
* Space Complexity: O(1)
|
|
202
|
-
*/
|
|
203
175
|
/**
|
|
204
176
|
* Time Complexity: O(1)
|
|
205
177
|
* Space Complexity: O(1)
|
|
@@ -215,10 +187,6 @@ export declare class TreeMultiMap<K = any, V = any, R = BTNEntry<K, V>, NODE ext
|
|
|
215
187
|
* If either `srcNode` or `destNode` is undefined, it returns undefined.
|
|
216
188
|
*/
|
|
217
189
|
protected _swapProperties(srcNode: R | BSTNKeyOrNode<K, NODE>, destNode: R | BSTNKeyOrNode<K, NODE>): NODE | undefined;
|
|
218
|
-
/**
|
|
219
|
-
* Time Complexity: O(1)
|
|
220
|
-
* Space Complexity: O(1)
|
|
221
|
-
*/
|
|
222
190
|
/**
|
|
223
191
|
* Time Complexity: O(1)
|
|
224
192
|
* Space Complexity: O(1)
|