data-structure-typed 2.5.1 → 2.5.2
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 +3 -1
- package/README.md +75 -17
- package/dist/cjs/binary-tree.cjs +2723 -139
- package/dist/cjs/graph.cjs +192 -6
- package/dist/cjs/hash.cjs +63 -15
- package/dist/cjs/heap.cjs +93 -31
- package/dist/cjs/index.cjs +3514 -379
- package/dist/cjs/linked-list.cjs +237 -31
- package/dist/cjs/matrix.cjs +47 -9
- package/dist/cjs/priority-queue.cjs +92 -30
- package/dist/cjs/queue.cjs +176 -2
- package/dist/cjs/stack.cjs +48 -2
- package/dist/cjs/trie.cjs +78 -28
- package/dist/cjs-legacy/binary-tree.cjs +2725 -136
- package/dist/cjs-legacy/graph.cjs +192 -6
- package/dist/cjs-legacy/hash.cjs +63 -15
- package/dist/cjs-legacy/heap.cjs +93 -31
- package/dist/cjs-legacy/index.cjs +3389 -249
- package/dist/cjs-legacy/linked-list.cjs +237 -31
- package/dist/cjs-legacy/matrix.cjs +47 -9
- package/dist/cjs-legacy/priority-queue.cjs +92 -30
- package/dist/cjs-legacy/queue.cjs +176 -2
- package/dist/cjs-legacy/stack.cjs +48 -2
- package/dist/cjs-legacy/trie.cjs +78 -28
- package/dist/esm/binary-tree.mjs +2723 -139
- package/dist/esm/graph.mjs +192 -6
- package/dist/esm/hash.mjs +63 -15
- package/dist/esm/heap.mjs +93 -31
- package/dist/esm/index.mjs +3514 -380
- package/dist/esm/linked-list.mjs +237 -31
- package/dist/esm/matrix.mjs +47 -9
- package/dist/esm/priority-queue.mjs +92 -30
- package/dist/esm/queue.mjs +176 -2
- package/dist/esm/stack.mjs +48 -2
- package/dist/esm/trie.mjs +78 -28
- package/dist/esm-legacy/binary-tree.mjs +2725 -136
- package/dist/esm-legacy/graph.mjs +192 -6
- package/dist/esm-legacy/hash.mjs +63 -15
- package/dist/esm-legacy/heap.mjs +93 -31
- package/dist/esm-legacy/index.mjs +3389 -250
- package/dist/esm-legacy/linked-list.mjs +237 -31
- package/dist/esm-legacy/matrix.mjs +47 -9
- package/dist/esm-legacy/priority-queue.mjs +92 -30
- package/dist/esm-legacy/queue.mjs +176 -2
- package/dist/esm-legacy/stack.mjs +48 -2
- package/dist/esm-legacy/trie.mjs +78 -28
- package/dist/types/common/error.d.ts +9 -0
- package/dist/types/common/index.d.ts +1 -1
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +48 -0
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +56 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +102 -2
- package/dist/types/data-structures/binary-tree/bst.d.ts +195 -0
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +76 -0
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +24 -0
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +528 -0
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +531 -6
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +435 -6
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +505 -0
- package/dist/types/data-structures/graph/directed-graph.d.ts +40 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +36 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +44 -0
- package/dist/types/data-structures/heap/heap.d.ts +56 -0
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +68 -0
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +60 -0
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +72 -0
- package/dist/types/data-structures/matrix/matrix.d.ts +32 -0
- package/dist/types/data-structures/queue/deque.d.ts +60 -0
- package/dist/types/data-structures/queue/queue.d.ts +48 -0
- package/dist/types/data-structures/stack/stack.d.ts +40 -0
- package/dist/types/data-structures/trie/trie.d.ts +48 -0
- package/dist/types/types/data-structures/binary-tree/bst.d.ts +1 -0
- package/dist/types/types/data-structures/binary-tree/tree-map.d.ts +5 -0
- package/dist/types/types/data-structures/binary-tree/tree-multi-set.d.ts +4 -0
- package/dist/types/types/data-structures/binary-tree/tree-set.d.ts +4 -0
- package/dist/umd/data-structure-typed.js +3404 -265
- package/dist/umd/data-structure-typed.min.js +5 -5
- package/docs-site-docusaurus/docs/api/classes/AVLTree.md +650 -136
- package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +11 -11
- package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +71 -71
- package/docs-site-docusaurus/docs/api/classes/BST.md +591 -129
- package/docs-site-docusaurus/docs/api/classes/BSTNode.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +15 -15
- package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +107 -107
- package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/Deque.md +82 -82
- package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +82 -82
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +74 -74
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedListNode.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +9 -9
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +1 -1
- package/docs-site-docusaurus/docs/api/classes/HashMap.md +47 -47
- package/docs-site-docusaurus/docs/api/classes/Heap.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +25 -25
- package/docs-site-docusaurus/docs/api/classes/IterableEntryBase.md +33 -33
- package/docs-site-docusaurus/docs/api/classes/LinearBase.md +50 -50
- package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +55 -55
- package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +49 -49
- package/docs-site-docusaurus/docs/api/classes/LinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +78 -78
- package/docs-site-docusaurus/docs/api/classes/MapGraph.md +82 -82
- package/docs-site-docusaurus/docs/api/classes/Matrix.md +31 -31
- package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/MinHeap.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/Navigator.md +5 -5
- package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +44 -44
- package/docs-site-docusaurus/docs/api/classes/Queue.md +60 -60
- package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +660 -146
- package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +10 -10
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +78 -78
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/SkipList.md +44 -44
- package/docs-site-docusaurus/docs/api/classes/Stack.md +39 -39
- package/docs-site-docusaurus/docs/api/classes/TreeMap.md +165 -33
- package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +162 -46
- package/docs-site-docusaurus/docs/api/classes/TreeSet.md +161 -32
- package/docs-site-docusaurus/docs/api/classes/Trie.md +47 -47
- package/docs-site-docusaurus/docs/api/classes/TrieNode.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +81 -81
- package/docs-site-docusaurus/docs/guide/architecture.md +2 -0
- package/docs-site-docusaurus/docs/guide/concepts.md +32 -1
- package/docs-site-docusaurus/docs/guide/faq.md +180 -0
- package/docs-site-docusaurus/docs/guide/guides.md +40 -54
- package/docs-site-docusaurus/docs/guide/installation.md +2 -0
- package/docs-site-docusaurus/docs/guide/integrations.md +2 -0
- package/docs-site-docusaurus/docs/guide/overview.md +7 -0
- package/docs-site-docusaurus/docs/guide/performance.md +2 -0
- package/docs-site-docusaurus/docs/guide/quick-start.md +31 -0
- package/docs-site-docusaurus/docs/guide/use-cases/_category_.json +6 -0
- package/docs-site-docusaurus/docs/guide/use-cases/array-sort-alternative.md +158 -0
- package/docs-site-docusaurus/docs/guide/use-cases/heap-vs-sorting.md +92 -0
- package/docs-site-docusaurus/docs/guide/use-cases/map-vs-treemap.md +151 -0
- package/docs-site-docusaurus/docs/guide/use-cases/priority-queue-typescript.md +113 -0
- package/docs-site-docusaurus/docs/guide/use-cases/treemap-javascript.md +151 -0
- package/docs-site-docusaurus/docusaurus.config.ts +1 -1
- package/docs-site-docusaurus/src/pages/index.tsx +51 -2
- package/docs-site-docusaurus/static/llms.txt +37 -0
- package/llms.txt +37 -0
- package/package.json +64 -56
- package/src/common/error.ts +19 -1
- package/src/common/index.ts +1 -1
- package/src/data-structures/base/iterable-element-base.ts +3 -2
- package/src/data-structures/binary-tree/avl-tree.ts +47 -0
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +46 -4
- package/src/data-structures/binary-tree/binary-tree.ts +79 -4
- package/src/data-structures/binary-tree/bst.ts +441 -6
- package/src/data-structures/binary-tree/red-black-tree.ts +73 -0
- package/src/data-structures/binary-tree/segment-tree.ts +18 -0
- package/src/data-structures/binary-tree/tree-map.ts +434 -9
- package/src/data-structures/binary-tree/tree-multi-map.ts +426 -5
- package/src/data-structures/binary-tree/tree-multi-set.ts +350 -6
- package/src/data-structures/binary-tree/tree-set.ts +410 -8
- package/src/data-structures/graph/abstract-graph.ts +2 -2
- package/src/data-structures/graph/directed-graph.ts +30 -0
- package/src/data-structures/graph/undirected-graph.ts +27 -0
- package/src/data-structures/hash/hash-map.ts +35 -4
- package/src/data-structures/heap/heap.ts +46 -4
- package/src/data-structures/heap/max-heap.ts +2 -2
- package/src/data-structures/linked-list/doubly-linked-list.ts +51 -0
- package/src/data-structures/linked-list/singly-linked-list.ts +45 -0
- package/src/data-structures/linked-list/skip-linked-list.ts +59 -5
- package/src/data-structures/matrix/matrix.ts +33 -9
- package/src/data-structures/priority-queue/max-priority-queue.ts +2 -2
- package/src/data-structures/queue/deque.ts +45 -0
- package/src/data-structures/queue/queue.ts +36 -0
- package/src/data-structures/stack/stack.ts +30 -0
- package/src/data-structures/trie/trie.ts +38 -2
- package/src/types/data-structures/binary-tree/bst.ts +1 -0
- package/src/types/data-structures/binary-tree/tree-map.ts +6 -0
- package/src/types/data-structures/binary-tree/tree-multi-set.ts +5 -0
- package/src/types/data-structures/binary-tree/tree-set.ts +5 -0
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Class: BinaryTree\<K, V, R\>
|
|
8
8
|
|
|
9
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:270](https://github.com/zrwusa/data-structure-typed/blob/
|
|
9
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:270](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L270)
|
|
10
10
|
|
|
11
11
|
A general Binary Tree implementation.
|
|
12
12
|
|
|
@@ -29,7 +29,7 @@ The `set` operation inserts nodes level-by-level (BFS) into the first available
|
|
|
29
29
|
node?: BinaryTreeNode<string> | null,
|
|
30
30
|
conditions?: { [key: string]: boolean }
|
|
31
31
|
): string {
|
|
32
|
-
if (!node)
|
|
32
|
+
if (!node) raise(Error, 'Invalid node');
|
|
33
33
|
|
|
34
34
|
// If it's a leaf node, return the decision result
|
|
35
35
|
if (!node.left && !node.right) return node.key;
|
|
@@ -76,7 +76,7 @@ The `set` operation inserts nodes level-by-level (BFS) into the first available
|
|
|
76
76
|
case '/':
|
|
77
77
|
return rightValue !== 0 ? leftValue / rightValue : 0; // Handle division by zero
|
|
78
78
|
default:
|
|
79
|
-
|
|
79
|
+
raise(Error, `Unsupported operator: ${node.key}`);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
@@ -128,7 +128,7 @@ The type of the raw data object (if using `toEntryFn`).
|
|
|
128
128
|
new BinaryTree<K, V, R>(keysNodesEntriesOrRaws?, options?): BinaryTree<K, V, R>;
|
|
129
129
|
```
|
|
130
130
|
|
|
131
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:283](https://github.com/zrwusa/data-structure-typed/blob/
|
|
131
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:283](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L283)
|
|
132
132
|
|
|
133
133
|
Creates an instance of BinaryTree.
|
|
134
134
|
|
|
@@ -176,7 +176,7 @@ IterableEntryBase<K, V | undefined>.constructor
|
|
|
176
176
|
get isDuplicate(): boolean;
|
|
177
177
|
```
|
|
178
178
|
|
|
179
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:322](https://github.com/zrwusa/data-structure-typed/blob/
|
|
179
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:322](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L322)
|
|
180
180
|
|
|
181
181
|
Gets whether the tree allows duplicate keys.
|
|
182
182
|
|
|
@@ -206,7 +206,7 @@ IBinaryTree.isDuplicate
|
|
|
206
206
|
get isMapMode(): boolean;
|
|
207
207
|
```
|
|
208
208
|
|
|
209
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:310](https://github.com/zrwusa/data-structure-typed/blob/
|
|
209
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:310](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L310)
|
|
210
210
|
|
|
211
211
|
Gets whether the tree is in Map mode.
|
|
212
212
|
|
|
@@ -236,7 +236,7 @@ IBinaryTree.isMapMode
|
|
|
236
236
|
get NIL(): BinaryTreeNode<K, V>;
|
|
237
237
|
```
|
|
238
238
|
|
|
239
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:373](https://github.com/zrwusa/data-structure-typed/blob/
|
|
239
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:373](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L373)
|
|
240
240
|
|
|
241
241
|
Gets the sentinel NIL node (used in self-balancing trees like Red-Black Tree).
|
|
242
242
|
|
|
@@ -266,7 +266,7 @@ IBinaryTree.NIL
|
|
|
266
266
|
get root(): BinaryTreeNode<K, V> | null | undefined;
|
|
267
267
|
```
|
|
268
268
|
|
|
269
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:349](https://github.com/zrwusa/data-structure-typed/blob/
|
|
269
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:349](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L349)
|
|
270
270
|
|
|
271
271
|
Gets the root node of the tree.
|
|
272
272
|
|
|
@@ -296,7 +296,7 @@ IBinaryTree.root
|
|
|
296
296
|
get size(): number;
|
|
297
297
|
```
|
|
298
298
|
|
|
299
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:361](https://github.com/zrwusa/data-structure-typed/blob/
|
|
299
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:361](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L361)
|
|
300
300
|
|
|
301
301
|
Gets the number of nodes in the tree.
|
|
302
302
|
|
|
@@ -330,7 +330,7 @@ IBinaryTree.size
|
|
|
330
330
|
get store(): Map<K, BinaryTreeNode<K, V>>;
|
|
331
331
|
```
|
|
332
332
|
|
|
333
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:337](https://github.com/zrwusa/data-structure-typed/blob/
|
|
333
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:337](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L337)
|
|
334
334
|
|
|
335
335
|
Gets the external value store (used in Map mode).
|
|
336
336
|
|
|
@@ -360,7 +360,7 @@ IBinaryTree.store
|
|
|
360
360
|
get toEntryFn(): ToEntryFn<K, V, R> | undefined;
|
|
361
361
|
```
|
|
362
362
|
|
|
363
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:385](https://github.com/zrwusa/data-structure-typed/blob/
|
|
363
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:385](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L385)
|
|
364
364
|
|
|
365
365
|
Gets the function used to convert raw data objects (R) into [key, value] entries.
|
|
366
366
|
|
|
@@ -388,7 +388,7 @@ IBinaryTree.toEntryFn
|
|
|
388
388
|
iterator: IterableIterator<[K, V | undefined]>;
|
|
389
389
|
```
|
|
390
390
|
|
|
391
|
-
Defined in: [data-structures/base/iterable-entry-base.ts:22](https://github.com/zrwusa/data-structure-typed/blob/
|
|
391
|
+
Defined in: [data-structures/base/iterable-entry-base.ts:22](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L22)
|
|
392
392
|
|
|
393
393
|
Default iterator yielding `[key, value]` entries.
|
|
394
394
|
|
|
@@ -396,7 +396,7 @@ Default iterator yielding `[key, value]` entries.
|
|
|
396
396
|
|
|
397
397
|
##### args
|
|
398
398
|
|
|
399
|
-
...`
|
|
399
|
+
...`unknown`[]
|
|
400
400
|
|
|
401
401
|
#### Returns
|
|
402
402
|
|
|
@@ -426,7 +426,7 @@ IBinaryTree.[iterator]
|
|
|
426
426
|
add(keyNodeOrEntry): boolean;
|
|
427
427
|
```
|
|
428
428
|
|
|
429
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
429
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:608](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L608)
|
|
430
430
|
|
|
431
431
|
Adds a new node to the tree.
|
|
432
432
|
|
|
@@ -480,7 +480,7 @@ IBinaryTree.add
|
|
|
480
480
|
addMany(keysNodesEntriesOrRaws): boolean[];
|
|
481
481
|
```
|
|
482
482
|
|
|
483
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
483
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:781](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L781)
|
|
484
484
|
|
|
485
485
|
Adds multiple items to the tree.
|
|
486
486
|
|
|
@@ -561,7 +561,7 @@ If true, includes null nodes in the traversal.
|
|
|
561
561
|
bfs(): (K | undefined)[];
|
|
562
562
|
```
|
|
563
563
|
|
|
564
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
564
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2191](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2191)
|
|
565
565
|
|
|
566
566
|
BinaryTree level-order traversal
|
|
567
567
|
|
|
@@ -618,7 +618,7 @@ bfs<C>(
|
|
|
618
618
|
includeNull?): ReturnType<C>[];
|
|
619
619
|
```
|
|
620
620
|
|
|
621
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
621
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2193](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2193)
|
|
622
622
|
|
|
623
623
|
BinaryTree level-order traversal
|
|
624
624
|
|
|
@@ -702,7 +702,7 @@ bfs<C>(
|
|
|
702
702
|
includeNull?): ReturnType<C>[];
|
|
703
703
|
```
|
|
704
704
|
|
|
705
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
705
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2200](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2200)
|
|
706
706
|
|
|
707
707
|
BinaryTree level-order traversal
|
|
708
708
|
|
|
@@ -784,7 +784,7 @@ IBinaryTree.bfs
|
|
|
784
784
|
clear(): void;
|
|
785
785
|
```
|
|
786
786
|
|
|
787
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
787
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1509](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1509)
|
|
788
788
|
|
|
789
789
|
Clears the tree of all nodes and values.
|
|
790
790
|
|
|
@@ -825,7 +825,7 @@ IBinaryTree.clear
|
|
|
825
825
|
clone(): this;
|
|
826
826
|
```
|
|
827
827
|
|
|
828
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
828
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2697](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2697)
|
|
829
829
|
|
|
830
830
|
Clones the tree.
|
|
831
831
|
|
|
@@ -869,7 +869,7 @@ IBinaryTree.clone
|
|
|
869
869
|
createNode(key, value?): BinaryTreeNode<K, V>;
|
|
870
870
|
```
|
|
871
871
|
|
|
872
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:397](https://github.com/zrwusa/data-structure-typed/blob/
|
|
872
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:397](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L397)
|
|
873
873
|
|
|
874
874
|
(Protected) Creates a new node.
|
|
875
875
|
|
|
@@ -911,7 +911,7 @@ IBinaryTree.createNode
|
|
|
911
911
|
createTree(options?): this;
|
|
912
912
|
```
|
|
913
913
|
|
|
914
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:408](https://github.com/zrwusa/data-structure-typed/blob/
|
|
914
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:408](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L408)
|
|
915
915
|
|
|
916
916
|
Creates a new, empty tree of the same type and configuration.
|
|
917
917
|
|
|
@@ -947,7 +947,7 @@ IBinaryTree.createTree
|
|
|
947
947
|
delete(keyNodeEntryRawOrPredicate): BinaryTreeDeleteResult<BinaryTreeNode<K, V>>[];
|
|
948
948
|
```
|
|
949
949
|
|
|
950
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
950
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:971](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L971)
|
|
951
951
|
|
|
952
952
|
Deletes a node from the tree.
|
|
953
953
|
|
|
@@ -1032,7 +1032,7 @@ If true, includes null nodes in the traversal.
|
|
|
1032
1032
|
dfs(): (K | undefined)[];
|
|
1033
1033
|
```
|
|
1034
1034
|
|
|
1035
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
1035
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2081](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2081)
|
|
1036
1036
|
|
|
1037
1037
|
Depth-first search traversal
|
|
1038
1038
|
|
|
@@ -1068,7 +1068,7 @@ dfs<C>(
|
|
|
1068
1068
|
iterationType?): ReturnType<C>[];
|
|
1069
1069
|
```
|
|
1070
1070
|
|
|
1071
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
1071
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2083](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2083)
|
|
1072
1072
|
|
|
1073
1073
|
Depth-first search traversal
|
|
1074
1074
|
|
|
@@ -1136,7 +1136,7 @@ dfs<C>(
|
|
|
1136
1136
|
includeNull?): ReturnType<C>[];
|
|
1137
1137
|
```
|
|
1138
1138
|
|
|
1139
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
1139
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2091](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2091)
|
|
1140
1140
|
|
|
1141
1141
|
Depth-first search traversal
|
|
1142
1142
|
|
|
@@ -1204,7 +1204,7 @@ IBinaryTree.dfs
|
|
|
1204
1204
|
ensureNode(keyNodeOrEntry, iterationType?): BinaryTreeNode<K, V> | null | undefined;
|
|
1205
1205
|
```
|
|
1206
1206
|
|
|
1207
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:420](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1207
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:420](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L420)
|
|
1208
1208
|
|
|
1209
1209
|
Ensures the input is a node. If it's a key or entry, it searches for the node.
|
|
1210
1210
|
|
|
@@ -1244,7 +1244,7 @@ Time O(1) if a node is passed. O(N) if a key or entry is passed (due to `getNode
|
|
|
1244
1244
|
entries(): IterableIterator<[K, V | undefined]>;
|
|
1245
1245
|
```
|
|
1246
1246
|
|
|
1247
|
-
Defined in: [data-structures/base/iterable-entry-base.ts:31](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1247
|
+
Defined in: [data-structures/base/iterable-entry-base.ts:31](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L31)
|
|
1248
1248
|
|
|
1249
1249
|
Iterate over `[key, value]` pairs (may yield `undefined` values).
|
|
1250
1250
|
|
|
@@ -1276,7 +1276,7 @@ IBinaryTree.entries
|
|
|
1276
1276
|
every(predicate, thisArg?): boolean;
|
|
1277
1277
|
```
|
|
1278
1278
|
|
|
1279
|
-
Defined in: [data-structures/base/iterable-entry-base.ts:66](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1279
|
+
Defined in: [data-structures/base/iterable-entry-base.ts:66](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L66)
|
|
1280
1280
|
|
|
1281
1281
|
Test whether all entries satisfy the predicate.
|
|
1282
1282
|
|
|
@@ -1290,7 +1290,7 @@ Test whether all entries satisfy the predicate.
|
|
|
1290
1290
|
|
|
1291
1291
|
##### thisArg?
|
|
1292
1292
|
|
|
1293
|
-
`
|
|
1293
|
+
`unknown`
|
|
1294
1294
|
|
|
1295
1295
|
Optional `this` for callback.
|
|
1296
1296
|
|
|
@@ -1322,7 +1322,7 @@ IBinaryTree.every
|
|
|
1322
1322
|
filter(predicate, thisArg?): this;
|
|
1323
1323
|
```
|
|
1324
1324
|
|
|
1325
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
1325
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2749](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2749)
|
|
1326
1326
|
|
|
1327
1327
|
Creates a new tree containing only the entries that satisfy the predicate.
|
|
1328
1328
|
|
|
@@ -1379,7 +1379,7 @@ IBinaryTree.filter
|
|
|
1379
1379
|
find(callbackfn, thisArg?): [K, V | undefined] | undefined;
|
|
1380
1380
|
```
|
|
1381
1381
|
|
|
1382
|
-
Defined in: [data-structures/base/iterable-entry-base.ts:114](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1382
|
+
Defined in: [data-structures/base/iterable-entry-base.ts:114](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L114)
|
|
1383
1383
|
|
|
1384
1384
|
Find the first entry that matches a predicate.
|
|
1385
1385
|
|
|
@@ -1393,7 +1393,7 @@ Find the first entry that matches a predicate.
|
|
|
1393
1393
|
|
|
1394
1394
|
##### thisArg?
|
|
1395
1395
|
|
|
1396
|
-
`
|
|
1396
|
+
`unknown`
|
|
1397
1397
|
|
|
1398
1398
|
Optional `this` for callback.
|
|
1399
1399
|
|
|
@@ -1425,7 +1425,7 @@ IBinaryTree.find
|
|
|
1425
1425
|
forEach(callbackfn, thisArg?): void;
|
|
1426
1426
|
```
|
|
1427
1427
|
|
|
1428
|
-
Defined in: [data-structures/base/iterable-entry-base.ts:99](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1428
|
+
Defined in: [data-structures/base/iterable-entry-base.ts:99](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L99)
|
|
1429
1429
|
|
|
1430
1430
|
Visit each entry, left-to-right.
|
|
1431
1431
|
|
|
@@ -1439,7 +1439,7 @@ Visit each entry, left-to-right.
|
|
|
1439
1439
|
|
|
1440
1440
|
##### thisArg?
|
|
1441
1441
|
|
|
1442
|
-
`
|
|
1442
|
+
`unknown`
|
|
1443
1443
|
|
|
1444
1444
|
Optional `this` for callback.
|
|
1445
1445
|
|
|
@@ -1472,7 +1472,7 @@ get(
|
|
|
1472
1472
|
iterationType?): V | undefined;
|
|
1473
1473
|
```
|
|
1474
1474
|
|
|
1475
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
1475
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1349](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1349)
|
|
1476
1476
|
|
|
1477
1477
|
Gets the value associated with a key.
|
|
1478
1478
|
|
|
@@ -1542,7 +1542,7 @@ IBinaryTree.get
|
|
|
1542
1542
|
getDepth(dist, startNode?): number;
|
|
1543
1543
|
```
|
|
1544
1544
|
|
|
1545
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
1545
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1710](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1710)
|
|
1546
1546
|
|
|
1547
1547
|
Gets the depth of a node (distance from `startNode`).
|
|
1548
1548
|
|
|
@@ -1602,7 +1602,7 @@ IBinaryTree.getDepth
|
|
|
1602
1602
|
getHeight(startNode?, iterationType?): number;
|
|
1603
1603
|
```
|
|
1604
1604
|
|
|
1605
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
1605
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1774](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1774)
|
|
1606
1606
|
|
|
1607
1607
|
Gets the maximum height of the tree (longest path from startNode to a leaf).
|
|
1608
1608
|
|
|
@@ -1681,7 +1681,7 @@ The traversal method.
|
|
|
1681
1681
|
getLeftMost(): K | undefined;
|
|
1682
1682
|
```
|
|
1683
1683
|
|
|
1684
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
1684
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1901](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1901)
|
|
1685
1685
|
|
|
1686
1686
|
##### Returns
|
|
1687
1687
|
|
|
@@ -1702,7 +1702,7 @@ getLeftMost<C>(
|
|
|
1702
1702
|
iterationType?): ReturnType<C>;
|
|
1703
1703
|
```
|
|
1704
1704
|
|
|
1705
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
1705
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1903](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1903)
|
|
1706
1706
|
|
|
1707
1707
|
##### Type Parameters
|
|
1708
1708
|
|
|
@@ -1745,7 +1745,7 @@ IBinaryTree.getLeftMost
|
|
|
1745
1745
|
getMinHeight(startNode?, iterationType?): number;
|
|
1746
1746
|
```
|
|
1747
1747
|
|
|
1748
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
1748
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1816](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1816)
|
|
1749
1749
|
|
|
1750
1750
|
Gets the minimum height of the tree (shortest path from startNode to a leaf).
|
|
1751
1751
|
|
|
@@ -1793,7 +1793,7 @@ getNode(
|
|
|
1793
1793
|
iterationType?): BinaryTreeNode<K, V> | null | undefined;
|
|
1794
1794
|
```
|
|
1795
1795
|
|
|
1796
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
1796
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1279](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1279)
|
|
1797
1797
|
|
|
1798
1798
|
Gets the first node matching a predicate.
|
|
1799
1799
|
|
|
@@ -1863,7 +1863,7 @@ getNodes(
|
|
|
1863
1863
|
iterationType?): BinaryTreeNode<K, V>[];
|
|
1864
1864
|
```
|
|
1865
1865
|
|
|
1866
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
1866
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1205](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1205)
|
|
1867
1867
|
|
|
1868
1868
|
Gets all nodes matching a predicate.
|
|
1869
1869
|
|
|
@@ -1954,7 +1954,7 @@ If true, returns the path from root-to-node.
|
|
|
1954
1954
|
getPathToRoot(beginNode): (K | undefined)[];
|
|
1955
1955
|
```
|
|
1956
1956
|
|
|
1957
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
1957
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1863](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1863)
|
|
1958
1958
|
|
|
1959
1959
|
##### Parameters
|
|
1960
1960
|
|
|
@@ -1985,7 +1985,7 @@ getPathToRoot<C>(
|
|
|
1985
1985
|
isReverse?): ReturnType<C>[];
|
|
1986
1986
|
```
|
|
1987
1987
|
|
|
1988
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
1988
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1867](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1867)
|
|
1989
1989
|
|
|
1990
1990
|
##### Type Parameters
|
|
1991
1991
|
|
|
@@ -2029,7 +2029,7 @@ IBinaryTree.getPathToRoot
|
|
|
2029
2029
|
getPredecessor(node): BinaryTreeNode<K, V>;
|
|
2030
2030
|
```
|
|
2031
2031
|
|
|
2032
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
2032
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2001](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2001)
|
|
2033
2033
|
|
|
2034
2034
|
Gets the Morris traversal predecessor (rightmost node in the left subtree, or node itself).
|
|
2035
2035
|
|
|
@@ -2083,7 +2083,7 @@ The traversal method.
|
|
|
2083
2083
|
getRightMost(): K | undefined;
|
|
2084
2084
|
```
|
|
2085
2085
|
|
|
2086
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
2086
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1948](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1948)
|
|
2087
2087
|
|
|
2088
2088
|
##### Returns
|
|
2089
2089
|
|
|
@@ -2104,7 +2104,7 @@ getRightMost<C>(
|
|
|
2104
2104
|
iterationType?): ReturnType<C>;
|
|
2105
2105
|
```
|
|
2106
2106
|
|
|
2107
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
2107
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1950](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1950)
|
|
2108
2108
|
|
|
2109
2109
|
##### Type Parameters
|
|
2110
2110
|
|
|
@@ -2147,7 +2147,7 @@ IBinaryTree.getRightMost
|
|
|
2147
2147
|
getSuccessor(x?): BinaryTreeNode<K, V> | null | undefined;
|
|
2148
2148
|
```
|
|
2149
2149
|
|
|
2150
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
2150
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2022](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2022)
|
|
2151
2151
|
|
|
2152
2152
|
Gets the in-order successor of a node in a BST.
|
|
2153
2153
|
|
|
@@ -2180,7 +2180,7 @@ has(
|
|
|
2180
2180
|
iterationType?): boolean;
|
|
2181
2181
|
```
|
|
2182
2182
|
|
|
2183
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
2183
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1434](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1434)
|
|
2184
2184
|
|
|
2185
2185
|
Checks if a node matching the predicate exists in the tree.
|
|
2186
2186
|
|
|
@@ -2273,7 +2273,7 @@ IBinaryTree.has
|
|
|
2273
2273
|
hasValue(value): boolean;
|
|
2274
2274
|
```
|
|
2275
2275
|
|
|
2276
|
-
Defined in: [data-structures/base/iterable-entry-base.ts:143](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2276
|
+
Defined in: [data-structures/base/iterable-entry-base.ts:143](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L143)
|
|
2277
2277
|
|
|
2278
2278
|
Whether there exists an entry with the given value.
|
|
2279
2279
|
|
|
@@ -2313,7 +2313,7 @@ IBinaryTree.hasValue
|
|
|
2313
2313
|
isBST(startNode?, iterationType?): boolean;
|
|
2314
2314
|
```
|
|
2315
2315
|
|
|
2316
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
2316
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1619](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1619)
|
|
2317
2317
|
|
|
2318
2318
|
Checks if the tree is a valid Binary Search Tree (BST).
|
|
2319
2319
|
|
|
@@ -2369,7 +2369,7 @@ IBinaryTree.isBST
|
|
|
2369
2369
|
isEmpty(): boolean;
|
|
2370
2370
|
```
|
|
2371
2371
|
|
|
2372
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
2372
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1556](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1556)
|
|
2373
2373
|
|
|
2374
2374
|
Checks if the tree is empty.
|
|
2375
2375
|
|
|
@@ -2410,7 +2410,7 @@ IBinaryTree.isEmpty
|
|
|
2410
2410
|
isEntry(keyNodeOrEntry): keyNodeOrEntry is BTNEntry<K, V>;
|
|
2411
2411
|
```
|
|
2412
2412
|
|
|
2413
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:545](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2413
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:545](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L545)
|
|
2414
2414
|
|
|
2415
2415
|
Checks if the given item is a [key, value] entry pair.
|
|
2416
2416
|
|
|
@@ -2444,7 +2444,7 @@ Time O(1), Space O(1)
|
|
|
2444
2444
|
isLeaf(keyNodeOrEntry): boolean;
|
|
2445
2445
|
```
|
|
2446
2446
|
|
|
2447
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:531](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2447
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:531](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L531)
|
|
2448
2448
|
|
|
2449
2449
|
Checks if a node is a leaf (has no real children).
|
|
2450
2450
|
|
|
@@ -2478,7 +2478,7 @@ Time O(N) if a key/entry is passed (due to `ensureNode`). O(1) if a node is pass
|
|
|
2478
2478
|
isNIL(keyNodeOrEntry): boolean;
|
|
2479
2479
|
```
|
|
2480
2480
|
|
|
2481
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:500](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2481
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:500](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L500)
|
|
2482
2482
|
|
|
2483
2483
|
Checks if the given item is the sentinel NIL node.
|
|
2484
2484
|
|
|
@@ -2512,7 +2512,7 @@ Time O(1), Space O(1)
|
|
|
2512
2512
|
isNode(keyNodeOrEntry): keyNodeOrEntry is BinaryTreeNode<K, V>;
|
|
2513
2513
|
```
|
|
2514
2514
|
|
|
2515
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:447](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2515
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:447](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L447)
|
|
2516
2516
|
|
|
2517
2517
|
Checks if the given item is a `BinaryTreeNode` instance.
|
|
2518
2518
|
|
|
@@ -2546,7 +2546,7 @@ Time O(1), Space O(1)
|
|
|
2546
2546
|
isPerfectlyBalanced(startNode?): boolean;
|
|
2547
2547
|
```
|
|
2548
2548
|
|
|
2549
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
2549
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1567](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1567)
|
|
2550
2550
|
|
|
2551
2551
|
Checks if the tree is perfectly balanced.
|
|
2552
2552
|
|
|
@@ -2585,7 +2585,7 @@ IBinaryTree.isPerfectlyBalanced
|
|
|
2585
2585
|
isRange(keyNodeEntryOrPredicate): keyNodeEntryOrPredicate is Range<K>;
|
|
2586
2586
|
```
|
|
2587
2587
|
|
|
2588
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:511](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2588
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:511](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L511)
|
|
2589
2589
|
|
|
2590
2590
|
Checks if the given item is a `Range` object.
|
|
2591
2591
|
|
|
@@ -2621,7 +2621,7 @@ Time O(1), Space O(1)
|
|
|
2621
2621
|
isRaw(keyNodeEntryOrRaw): keyNodeEntryOrRaw is R;
|
|
2622
2622
|
```
|
|
2623
2623
|
|
|
2624
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:460](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2624
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:460](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L460)
|
|
2625
2625
|
|
|
2626
2626
|
Checks if the given item is a raw data object (R) that needs conversion via `toEntryFn`.
|
|
2627
2627
|
|
|
@@ -2656,7 +2656,7 @@ Time O(1), Space O(1)
|
|
|
2656
2656
|
isRealNode(keyNodeOrEntry): keyNodeOrEntry is BinaryTreeNode<K, V>;
|
|
2657
2657
|
```
|
|
2658
2658
|
|
|
2659
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:473](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2659
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:473](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L473)
|
|
2660
2660
|
|
|
2661
2661
|
Checks if the given item is a "real" node (i.e., not null, undefined, or NIL).
|
|
2662
2662
|
|
|
@@ -2690,7 +2690,7 @@ Time O(1), Space O(1)
|
|
|
2690
2690
|
isRealNodeOrNull(keyNodeOrEntry): keyNodeOrEntry is BinaryTreeNode<K, V> | null;
|
|
2691
2691
|
```
|
|
2692
2692
|
|
|
2693
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:487](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2693
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:487](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L487)
|
|
2694
2694
|
|
|
2695
2695
|
Checks if the given item is either a "real" node or null.
|
|
2696
2696
|
|
|
@@ -2724,7 +2724,7 @@ Time O(1), Space O(1)
|
|
|
2724
2724
|
isValidKey(key): key is K;
|
|
2725
2725
|
```
|
|
2726
2726
|
|
|
2727
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:558](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2727
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:558](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L558)
|
|
2728
2728
|
|
|
2729
2729
|
Checks if the given key is valid (comparable or null).
|
|
2730
2730
|
|
|
@@ -2732,7 +2732,7 @@ Checks if the given key is valid (comparable or null).
|
|
|
2732
2732
|
|
|
2733
2733
|
##### key
|
|
2734
2734
|
|
|
2735
|
-
`
|
|
2735
|
+
`unknown`
|
|
2736
2736
|
|
|
2737
2737
|
The key to validate.
|
|
2738
2738
|
|
|
@@ -2754,7 +2754,7 @@ Time O(1), Space O(1)
|
|
|
2754
2754
|
keys(): IterableIterator<K>;
|
|
2755
2755
|
```
|
|
2756
2756
|
|
|
2757
|
-
Defined in: [data-structures/base/iterable-entry-base.ts:42](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2757
|
+
Defined in: [data-structures/base/iterable-entry-base.ts:42](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L42)
|
|
2758
2758
|
|
|
2759
2759
|
Iterate over keys only.
|
|
2760
2760
|
|
|
@@ -2810,7 +2810,7 @@ The traversal method.
|
|
|
2810
2810
|
leaves(): (K | undefined)[];
|
|
2811
2811
|
```
|
|
2812
2812
|
|
|
2813
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
2813
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2316](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2316)
|
|
2814
2814
|
|
|
2815
2815
|
Get leaf nodes
|
|
2816
2816
|
|
|
@@ -2844,7 +2844,7 @@ leaves<C>(
|
|
|
2844
2844
|
iterationType?): ReturnType<C>[];
|
|
2845
2845
|
```
|
|
2846
2846
|
|
|
2847
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
2847
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2318](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2318)
|
|
2848
2848
|
|
|
2849
2849
|
Get leaf nodes
|
|
2850
2850
|
|
|
@@ -2928,7 +2928,7 @@ If true, includes null nodes.
|
|
|
2928
2928
|
listLevels(): (K | undefined)[][];
|
|
2929
2929
|
```
|
|
2930
2930
|
|
|
2931
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
2931
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2417](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2417)
|
|
2932
2932
|
|
|
2933
2933
|
Level-order grouping
|
|
2934
2934
|
|
|
@@ -2964,7 +2964,7 @@ listLevels<C>(
|
|
|
2964
2964
|
includeNull?): ReturnType<C>[][];
|
|
2965
2965
|
```
|
|
2966
2966
|
|
|
2967
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
2967
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2419](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2419)
|
|
2968
2968
|
|
|
2969
2969
|
Level-order grouping
|
|
2970
2970
|
|
|
@@ -3027,7 +3027,7 @@ listLevels<C>(
|
|
|
3027
3027
|
includeNull?): ReturnType<C>[][];
|
|
3028
3028
|
```
|
|
3029
3029
|
|
|
3030
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
3030
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2426](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2426)
|
|
3031
3031
|
|
|
3032
3032
|
Level-order grouping
|
|
3033
3033
|
|
|
@@ -3091,7 +3091,7 @@ map<MK, MV, MR>(
|
|
|
3091
3091
|
thisArg?): BinaryTree<MK, MV, MR>;
|
|
3092
3092
|
```
|
|
3093
3093
|
|
|
3094
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
3094
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2806](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2806)
|
|
3095
3095
|
|
|
3096
3096
|
Creates a new tree by mapping each [key, value] pair to a new entry.
|
|
3097
3097
|
|
|
@@ -3174,7 +3174,7 @@ IBinaryTree.map
|
|
|
3174
3174
|
merge(anotherTree): void;
|
|
3175
3175
|
```
|
|
3176
3176
|
|
|
3177
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
3177
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:902](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L902)
|
|
3178
3178
|
|
|
3179
3179
|
Merges another tree into this one by seting all its nodes.
|
|
3180
3180
|
|
|
@@ -3244,7 +3244,7 @@ The node to start from.
|
|
|
3244
3244
|
morris(): (K | undefined)[];
|
|
3245
3245
|
```
|
|
3246
3246
|
|
|
3247
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
3247
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2534](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2534)
|
|
3248
3248
|
|
|
3249
3249
|
Morris traversal (O(1) space)
|
|
3250
3250
|
|
|
@@ -3278,7 +3278,7 @@ morris<C>(
|
|
|
3278
3278
|
startNode?): ReturnType<C>[];
|
|
3279
3279
|
```
|
|
3280
3280
|
|
|
3281
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
3281
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2536](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2536)
|
|
3282
3282
|
|
|
3283
3283
|
Morris traversal (O(1) space)
|
|
3284
3284
|
|
|
@@ -3334,7 +3334,7 @@ IBinaryTree.morris
|
|
|
3334
3334
|
print(options?, startNode?): void;
|
|
3335
3335
|
```
|
|
3336
3336
|
|
|
3337
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
3337
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2895](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2895)
|
|
3338
3338
|
|
|
3339
3339
|
Prints a visual representation of the tree to the console.
|
|
3340
3340
|
|
|
@@ -3385,7 +3385,7 @@ Time O(N) (via `toVisual`). Space O(N*H) or O(N^2) (via `toVisual`).
|
|
|
3385
3385
|
reduce<U>(callbackfn, initialValue): U;
|
|
3386
3386
|
```
|
|
3387
3387
|
|
|
3388
|
-
Defined in: [data-structures/base/iterable-entry-base.ts:171](https://github.com/zrwusa/data-structure-typed/blob/
|
|
3388
|
+
Defined in: [data-structures/base/iterable-entry-base.ts:171](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L171)
|
|
3389
3389
|
|
|
3390
3390
|
Reduce entries into a single accumulator.
|
|
3391
3391
|
|
|
@@ -3437,7 +3437,7 @@ IBinaryTree.reduce
|
|
|
3437
3437
|
refill(keysNodesEntriesOrRaws, values?): void;
|
|
3438
3438
|
```
|
|
3439
3439
|
|
|
3440
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
3440
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:913](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L913)
|
|
3441
3441
|
|
|
3442
3442
|
Clears the tree and refills it with new items.
|
|
3443
3443
|
|
|
@@ -3515,7 +3515,7 @@ Whether to use 'RECURSIVE' or 'ITERATIVE' search.
|
|
|
3515
3515
|
search(keyNodeEntryOrPredicate, onlyOne?): (K | undefined)[];
|
|
3516
3516
|
```
|
|
3517
3517
|
|
|
3518
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
3518
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1069](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1069)
|
|
3519
3519
|
|
|
3520
3520
|
Search by predicate
|
|
3521
3521
|
|
|
@@ -3566,7 +3566,7 @@ search<C>(
|
|
|
3566
3566
|
iterationType?): ReturnType<C>[];
|
|
3567
3567
|
```
|
|
3568
3568
|
|
|
3569
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
3569
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1080](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1080)
|
|
3570
3570
|
|
|
3571
3571
|
Search by predicate
|
|
3572
3572
|
|
|
@@ -3635,7 +3635,7 @@ IBinaryTree.search
|
|
|
3635
3635
|
set(keyNodeOrEntry, value?): boolean;
|
|
3636
3636
|
```
|
|
3637
3637
|
|
|
3638
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
3638
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:680](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L680)
|
|
3639
3639
|
|
|
3640
3640
|
Adds or updates a new node to the tree.
|
|
3641
3641
|
|
|
@@ -3710,7 +3710,7 @@ IBinaryTree.set
|
|
|
3710
3710
|
setMany(keysNodesEntriesOrRaws, values?): boolean[];
|
|
3711
3711
|
```
|
|
3712
3712
|
|
|
3713
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
3713
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:828](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L828)
|
|
3714
3714
|
|
|
3715
3715
|
Adds or updates multiple items to the tree.
|
|
3716
3716
|
|
|
@@ -3763,7 +3763,7 @@ Time O(N * M), where N is the number of items to set and M is the size of the tr
|
|
|
3763
3763
|
some(predicate, thisArg?): boolean;
|
|
3764
3764
|
```
|
|
3765
3765
|
|
|
3766
|
-
Defined in: [data-structures/base/iterable-entry-base.ts:83](https://github.com/zrwusa/data-structure-typed/blob/
|
|
3766
|
+
Defined in: [data-structures/base/iterable-entry-base.ts:83](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L83)
|
|
3767
3767
|
|
|
3768
3768
|
Test whether any entry satisfies the predicate.
|
|
3769
3769
|
|
|
@@ -3777,7 +3777,7 @@ Test whether any entry satisfies the predicate.
|
|
|
3777
3777
|
|
|
3778
3778
|
##### thisArg?
|
|
3779
3779
|
|
|
3780
|
-
`
|
|
3780
|
+
`unknown`
|
|
3781
3781
|
|
|
3782
3782
|
Optional `this` for callback.
|
|
3783
3783
|
|
|
@@ -3809,7 +3809,7 @@ IBinaryTree.some
|
|
|
3809
3809
|
toArray(): [K, V | undefined][];
|
|
3810
3810
|
```
|
|
3811
3811
|
|
|
3812
|
-
Defined in: [data-structures/base/iterable-entry-base.ts:186](https://github.com/zrwusa/data-structure-typed/blob/
|
|
3812
|
+
Defined in: [data-structures/base/iterable-entry-base.ts:186](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L186)
|
|
3813
3813
|
|
|
3814
3814
|
Converts data structure to `[key, value]` pairs.
|
|
3815
3815
|
|
|
@@ -3835,7 +3835,7 @@ Time O(n), Space O(n)
|
|
|
3835
3835
|
toVisual(startNode?, options?): string;
|
|
3836
3836
|
```
|
|
3837
3837
|
|
|
3838
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
3838
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2825](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2825)
|
|
3839
3839
|
|
|
3840
3840
|
Generates a string representation of the tree for visualization.
|
|
3841
3841
|
|
|
@@ -3878,7 +3878,7 @@ Time O(N), visits every node. Space O(N*H) or O(N^2) in the worst case, as the s
|
|
|
3878
3878
|
values(): IterableIterator<V | undefined>;
|
|
3879
3879
|
```
|
|
3880
3880
|
|
|
3881
|
-
Defined in: [data-structures/base/iterable-entry-base.ts:53](https://github.com/zrwusa/data-structure-typed/blob/
|
|
3881
|
+
Defined in: [data-structures/base/iterable-entry-base.ts:53](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L53)
|
|
3882
3882
|
|
|
3883
3883
|
Iterate over values only.
|
|
3884
3884
|
|
|
@@ -3913,7 +3913,7 @@ IBinaryTree.values
|
|
|
3913
3913
|
protected readonly _DEFAULT_NODE_CALLBACK: NodeCallback<BinaryTreeNode<K, V> | null | undefined, K | undefined>;
|
|
3914
3914
|
```
|
|
3915
3915
|
|
|
3916
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
3916
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3091](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3091)
|
|
3917
3917
|
|
|
3918
3918
|
(Protected) Default callback function, returns the node's key.
|
|
3919
3919
|
|
|
@@ -3937,7 +3937,7 @@ The node's key or undefined.
|
|
|
3937
3937
|
protected _clearNodes(): void;
|
|
3938
3938
|
```
|
|
3939
3939
|
|
|
3940
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
3940
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3525](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3525)
|
|
3941
3941
|
|
|
3942
3942
|
(Protected) Clears all nodes from the tree.
|
|
3943
3943
|
|
|
@@ -3957,7 +3957,7 @@ Time O(1)
|
|
|
3957
3957
|
protected _clearValues(): void;
|
|
3958
3958
|
```
|
|
3959
3959
|
|
|
3960
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
3960
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3534](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3534)
|
|
3961
3961
|
|
|
3962
3962
|
(Protected) Clears all values from the external store.
|
|
3963
3963
|
|
|
@@ -3977,7 +3977,7 @@ Time O(N)
|
|
|
3977
3977
|
protected _clone(cloned): void;
|
|
3978
3978
|
```
|
|
3979
3979
|
|
|
3980
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
3980
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3184](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3184)
|
|
3981
3981
|
|
|
3982
3982
|
(Protected) Helper for cloning. Performs a BFS and sets all nodes to the new tree.
|
|
3983
3983
|
|
|
@@ -4005,7 +4005,7 @@ Time O(N * M) (O(N) BFS + O(M) `set` for each node).
|
|
|
4005
4005
|
protected _createInstance<TK, TV, TR>(options?): this;
|
|
4006
4006
|
```
|
|
4007
4007
|
|
|
4008
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
4008
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3118](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3118)
|
|
4009
4009
|
|
|
4010
4010
|
(Protected) Creates a new, empty instance of the same tree constructor.
|
|
4011
4011
|
|
|
@@ -4049,7 +4049,7 @@ Time O(1)
|
|
|
4049
4049
|
protected _createLike<TK, TV, TR>(iter?, options?): BinaryTree<TK, TV, TR>;
|
|
4050
4050
|
```
|
|
4051
4051
|
|
|
4052
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
4052
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3135](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3135)
|
|
4053
4053
|
|
|
4054
4054
|
(Protected) Creates a new instance of the same tree constructor, potentially with different generic types.
|
|
4055
4055
|
|
|
@@ -4115,7 +4115,7 @@ protected _dfs<C>(
|
|
|
4115
4115
|
shouldProcessRoot?): ReturnType<C>[];
|
|
4116
4116
|
```
|
|
4117
4117
|
|
|
4118
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
4118
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2902](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2902)
|
|
4119
4119
|
|
|
4120
4120
|
#### Type Parameters
|
|
4121
4121
|
|
|
@@ -4204,7 +4204,7 @@ Array of callback results.
|
|
|
4204
4204
|
protected _displayAux(node, options): NodeDisplayLayout;
|
|
4205
4205
|
```
|
|
4206
4206
|
|
|
4207
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
4207
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3208](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3208)
|
|
4208
4208
|
|
|
4209
4209
|
(Protected) Recursive helper for `toVisual`.
|
|
4210
4210
|
|
|
@@ -4240,7 +4240,7 @@ Time O(N), Space O(N*H) or O(N^2)
|
|
|
4240
4240
|
protected _ensurePredicate(keyNodeEntryOrPredicate): NodePredicate<BinaryTreeNode<K, V>>;
|
|
4241
4241
|
```
|
|
4242
4242
|
|
|
4243
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
4243
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3431](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3431)
|
|
4244
4244
|
|
|
4245
4245
|
(Protected) Converts a key, node, entry, or predicate into a standardized predicate function.
|
|
4246
4246
|
|
|
@@ -4275,7 +4275,7 @@ Time O(1)
|
|
|
4275
4275
|
protected _extractKey(keyNodeOrEntry): K | null | undefined;
|
|
4276
4276
|
```
|
|
4277
4277
|
|
|
4278
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
4278
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3491](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3491)
|
|
4279
4279
|
|
|
4280
4280
|
(Protected) Extracts the key from a key, node, or entry.
|
|
4281
4281
|
|
|
@@ -4309,7 +4309,7 @@ Time O(1)
|
|
|
4309
4309
|
protected _getIterator(node?): IterableIterator<[K, V | undefined]>;
|
|
4310
4310
|
```
|
|
4311
4311
|
|
|
4312
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
4312
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3047](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3047)
|
|
4313
4313
|
|
|
4314
4314
|
(Protected) Gets the iterator for the tree (default in-order).
|
|
4315
4315
|
|
|
@@ -4343,7 +4343,7 @@ Time O(N) for full iteration. O(H) to get the first element. Space O(H) for the
|
|
|
4343
4343
|
protected _isDisplayLeaf(node, options): boolean;
|
|
4344
4344
|
```
|
|
4345
4345
|
|
|
4346
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
4346
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3303](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3303)
|
|
4347
4347
|
|
|
4348
4348
|
Check if a node is a display leaf (empty, null, undefined, NIL, or real leaf).
|
|
4349
4349
|
|
|
@@ -4369,7 +4369,7 @@ Check if a node is a display leaf (empty, null, undefined, NIL, or real leaf).
|
|
|
4369
4369
|
protected _isPredicate(p): p is NodePredicate<BinaryTreeNode<K, V>>;
|
|
4370
4370
|
```
|
|
4371
4371
|
|
|
4372
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
4372
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3480](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3480)
|
|
4373
4373
|
|
|
4374
4374
|
(Protected) Checks if an item is a predicate function.
|
|
4375
4375
|
|
|
@@ -4377,7 +4377,7 @@ Defined in: [data-structures/binary-tree/binary-tree.ts:3305](https://github.com
|
|
|
4377
4377
|
|
|
4378
4378
|
##### p
|
|
4379
4379
|
|
|
4380
|
-
`
|
|
4380
|
+
`unknown`
|
|
4381
4381
|
|
|
4382
4382
|
The item to check.
|
|
4383
4383
|
|
|
@@ -4399,7 +4399,7 @@ Time O(1)
|
|
|
4399
4399
|
protected _keyValueNodeOrEntryToNodeAndValue(keyNodeOrEntry, value?): [BinaryTreeNode<K, V> | null | undefined, V | undefined];
|
|
4400
4400
|
```
|
|
4401
4401
|
|
|
4402
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
4402
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3158](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3158)
|
|
4403
4403
|
|
|
4404
4404
|
(Protected) Converts a key, node, or entry into a standardized [node, value] tuple.
|
|
4405
4405
|
|
|
@@ -4439,7 +4439,7 @@ Time O(1)
|
|
|
4439
4439
|
protected _replaceNode(oldNode, newNode): BinaryTreeNode<K, V>;
|
|
4440
4440
|
```
|
|
4441
4441
|
|
|
4442
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
4442
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3393](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3393)
|
|
4443
4443
|
|
|
4444
4444
|
(Protected) Replaces a node in the tree with a new node, maintaining children and parent links.
|
|
4445
4445
|
|
|
@@ -4478,7 +4478,7 @@ protected _resolveDisplayLeaf(
|
|
|
4478
4478
|
emptyDisplayLayout): NodeDisplayLayout;
|
|
4479
4479
|
```
|
|
4480
4480
|
|
|
4481
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
4481
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3333](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3333)
|
|
4482
4482
|
|
|
4483
4483
|
Resolve a display leaf node to its layout.
|
|
4484
4484
|
|
|
@@ -4508,7 +4508,7 @@ Resolve a display leaf node to its layout.
|
|
|
4508
4508
|
protected _setRoot(v): void;
|
|
4509
4509
|
```
|
|
4510
4510
|
|
|
4511
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
4511
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3417](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3417)
|
|
4512
4512
|
|
|
4513
4513
|
(Protected) Sets the root node and clears its parent reference.
|
|
4514
4514
|
|
|
@@ -4536,7 +4536,7 @@ Time O(1)
|
|
|
4536
4536
|
protected _setValue(key, value): boolean;
|
|
4537
4537
|
```
|
|
4538
4538
|
|
|
4539
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
4539
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3512](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3512)
|
|
4540
4540
|
|
|
4541
4541
|
(Protected) Sets a value in the external store (Map mode).
|
|
4542
4542
|
|
|
@@ -4572,7 +4572,7 @@ Time O(1) (average for Map.set).
|
|
|
4572
4572
|
protected _snapshotOptions<TK, TV, TR>(): BinaryTreeOptions<TK, TV, TR>;
|
|
4573
4573
|
```
|
|
4574
4574
|
|
|
4575
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
4575
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3101](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3101)
|
|
4576
4576
|
|
|
4577
4577
|
(Protected) Snapshots the current tree's configuration options.
|
|
4578
4578
|
|
|
@@ -4608,7 +4608,7 @@ Time O(1)
|
|
|
4608
4608
|
protected _swapProperties(srcNode, destNode): BinaryTreeNode<K, V> | undefined;
|
|
4609
4609
|
```
|
|
4610
4610
|
|
|
4611
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
4611
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3359](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3359)
|
|
4612
4612
|
|
|
4613
4613
|
(Protected) Swaps the key/value properties of two nodes.
|
|
4614
4614
|
|