data-structure-typed 2.5.3 → 2.6.1
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/.github/workflows/ci.yml +7 -2
- package/.github/workflows/release-package.yml +9 -2
- package/.husky/pre-commit +3 -0
- package/CHANGELOG.md +1 -1
- package/MIGRATION.md +48 -0
- package/README.md +20 -2
- package/README_CN.md +20 -2
- package/SPECIFICATION.md +24 -0
- package/SPECIFICATION.zh-CN.md +24 -0
- package/dist/cjs/binary-tree.cjs +1897 -19
- package/dist/cjs/graph.cjs +174 -0
- package/dist/cjs/hash.cjs +33 -0
- package/dist/cjs/heap.cjs +71 -0
- package/dist/cjs/index.cjs +2383 -3
- package/dist/cjs/linked-list.cjs +224 -2
- package/dist/cjs/matrix.cjs +24 -0
- package/dist/cjs/priority-queue.cjs +71 -0
- package/dist/cjs/queue.cjs +221 -1
- package/dist/cjs/stack.cjs +59 -0
- package/dist/cjs/trie.cjs +62 -0
- package/dist/cjs-legacy/binary-tree.cjs +1897 -19
- package/dist/cjs-legacy/graph.cjs +174 -0
- package/dist/cjs-legacy/hash.cjs +33 -0
- package/dist/cjs-legacy/heap.cjs +71 -0
- package/dist/cjs-legacy/index.cjs +2383 -3
- package/dist/cjs-legacy/linked-list.cjs +224 -2
- package/dist/cjs-legacy/matrix.cjs +24 -0
- package/dist/cjs-legacy/priority-queue.cjs +71 -0
- package/dist/cjs-legacy/queue.cjs +221 -1
- package/dist/cjs-legacy/stack.cjs +59 -0
- package/dist/cjs-legacy/trie.cjs +62 -0
- package/dist/esm/binary-tree.mjs +1897 -19
- package/dist/esm/graph.mjs +174 -0
- package/dist/esm/hash.mjs +33 -0
- package/dist/esm/heap.mjs +71 -0
- package/dist/esm/index.mjs +2383 -3
- package/dist/esm/linked-list.mjs +224 -2
- package/dist/esm/matrix.mjs +24 -0
- package/dist/esm/priority-queue.mjs +71 -0
- package/dist/esm/queue.mjs +221 -1
- package/dist/esm/stack.mjs +59 -0
- package/dist/esm/trie.mjs +62 -0
- package/dist/esm-legacy/binary-tree.mjs +1897 -19
- package/dist/esm-legacy/graph.mjs +174 -0
- package/dist/esm-legacy/hash.mjs +33 -0
- package/dist/esm-legacy/heap.mjs +71 -0
- package/dist/esm-legacy/index.mjs +2383 -3
- package/dist/esm-legacy/linked-list.mjs +224 -2
- package/dist/esm-legacy/matrix.mjs +24 -0
- package/dist/esm-legacy/priority-queue.mjs +71 -0
- package/dist/esm-legacy/queue.mjs +221 -1
- package/dist/esm-legacy/stack.mjs +59 -0
- package/dist/esm-legacy/trie.mjs +62 -0
- package/dist/types/data-structures/base/iterable-element-base.d.ts +17 -0
- package/dist/types/data-structures/base/linear-base.d.ts +6 -0
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +36 -0
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +42 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +75 -0
- package/dist/types/data-structures/binary-tree/bst.d.ts +72 -0
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +57 -0
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +18 -0
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +375 -0
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +389 -0
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +330 -0
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +438 -0
- package/dist/types/data-structures/graph/directed-graph.d.ts +30 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +27 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +33 -0
- package/dist/types/data-structures/heap/heap.d.ts +42 -0
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +75 -2
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +45 -0
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +54 -0
- package/dist/types/data-structures/matrix/matrix.d.ts +24 -0
- package/dist/types/data-structures/queue/deque.d.ts +90 -1
- package/dist/types/data-structures/queue/queue.d.ts +36 -0
- package/dist/types/data-structures/stack/stack.d.ts +30 -0
- package/dist/types/data-structures/trie/trie.d.ts +36 -0
- package/dist/umd/data-structure-typed.js +2383 -3
- package/dist/umd/data-structure-typed.min.js +3 -3
- package/docs-site-docusaurus/docs/api/classes/AVLTree.md +108 -108
- package/docs-site-docusaurus/docs/api/classes/BST.md +101 -101
- package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +66 -66
- package/docs-site-docusaurus/docs/api/classes/Deque.md +235 -51
- package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +21 -21
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +231 -67
- 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 +14 -14
- package/docs-site-docusaurus/docs/api/classes/Heap.md +117 -34
- package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +83 -13
- package/docs-site-docusaurus/docs/api/classes/LinearBase.md +124 -20
- package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +140 -32
- package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +30 -26
- package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +159 -51
- package/docs-site-docusaurus/docs/api/classes/MapGraph.md +20 -20
- package/docs-site-docusaurus/docs/api/classes/Matrix.md +23 -23
- package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +117 -34
- package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +117 -34
- package/docs-site-docusaurus/docs/api/classes/MinHeap.md +117 -34
- package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +117 -34
- package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +117 -34
- package/docs-site-docusaurus/docs/api/classes/Queue.md +142 -34
- package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +117 -117
- package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +158 -50
- package/docs-site-docusaurus/docs/api/classes/SkipList.md +21 -21
- package/docs-site-docusaurus/docs/api/classes/Stack.md +108 -26
- package/docs-site-docusaurus/docs/api/classes/TreeMap.md +33 -33
- package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +75 -39
- package/docs-site-docusaurus/docs/api/classes/TreeSet.md +301 -39
- package/docs-site-docusaurus/docs/api/classes/Trie.md +110 -28
- package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +20 -20
- package/jest.integration.config.js +1 -2
- package/package.json +51 -50
- package/src/common/error.ts +15 -32
- package/src/common/index.ts +0 -3
- package/src/data-structures/base/iterable-element-base.ts +32 -3
- package/src/data-structures/base/linear-base.ts +13 -36
- package/src/data-structures/binary-tree/avl-tree.ts +31 -493
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +47 -530
- package/src/data-structures/binary-tree/binary-tree.ts +326 -1236
- package/src/data-structures/binary-tree/bst.ts +158 -1010
- package/src/data-structures/binary-tree/red-black-tree.ts +451 -1233
- package/src/data-structures/binary-tree/segment-tree.ts +73 -333
- package/src/data-structures/binary-tree/tree-map.ts +462 -4749
- package/src/data-structures/binary-tree/tree-multi-map.ts +310 -4530
- package/src/data-structures/binary-tree/tree-multi-set.ts +300 -3652
- package/src/data-structures/binary-tree/tree-set.ts +437 -4443
- package/src/data-structures/graph/abstract-graph.ts +98 -167
- package/src/data-structures/graph/directed-graph.ts +137 -532
- package/src/data-structures/graph/map-graph.ts +0 -3
- package/src/data-structures/graph/undirected-graph.ts +132 -484
- package/src/data-structures/hash/hash-map.ts +154 -549
- package/src/data-structures/heap/heap.ts +200 -753
- package/src/data-structures/linked-list/doubly-linked-list.ts +153 -809
- package/src/data-structures/linked-list/singly-linked-list.ts +122 -749
- package/src/data-structures/linked-list/skip-linked-list.ts +211 -864
- package/src/data-structures/matrix/matrix.ts +179 -494
- package/src/data-structures/matrix/navigator.ts +0 -1
- package/src/data-structures/priority-queue/max-priority-queue.ts +1 -6
- package/src/data-structures/priority-queue/min-priority-queue.ts +6 -11
- package/src/data-structures/priority-queue/priority-queue.ts +1 -2
- package/src/data-structures/queue/deque.ts +241 -807
- package/src/data-structures/queue/queue.ts +102 -589
- package/src/data-structures/stack/stack.ts +76 -475
- package/src/data-structures/trie/trie.ts +98 -592
- package/src/types/common.ts +0 -10
- package/src/types/data-structures/binary-tree/bst.ts +0 -7
- package/src/types/data-structures/binary-tree/red-black-tree.ts +0 -1
- package/src/types/data-structures/graph/abstract-graph.ts +0 -2
- package/src/types/data-structures/hash/hash-map.ts +0 -3
- package/src/types/data-structures/hash/index.ts +0 -1
- package/src/types/data-structures/matrix/navigator.ts +0 -2
- package/src/types/utils/utils.ts +0 -7
- package/src/types/utils/validate-type.ts +0 -7
- package/src/utils/number.ts +0 -2
- package/src/utils/utils.ts +0 -5
|
@@ -530,7 +530,7 @@ IBinaryTree.[iterator]
|
|
|
530
530
|
add(keyNodeOrEntry): boolean;
|
|
531
531
|
```
|
|
532
532
|
|
|
533
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
533
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:615](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L615)
|
|
534
534
|
|
|
535
535
|
Adds a new node to the tree.
|
|
536
536
|
|
|
@@ -588,7 +588,7 @@ IBinaryTree.add
|
|
|
588
588
|
addMany(keysNodesEntriesOrRaws): boolean[];
|
|
589
589
|
```
|
|
590
590
|
|
|
591
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
591
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:802](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L802)
|
|
592
592
|
|
|
593
593
|
Adds multiple items to the tree.
|
|
594
594
|
|
|
@@ -669,7 +669,7 @@ The traversal method.
|
|
|
669
669
|
bfs(): (K | undefined)[];
|
|
670
670
|
```
|
|
671
671
|
|
|
672
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
672
|
+
Defined in: [data-structures/binary-tree/bst.ts:647](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L647)
|
|
673
673
|
|
|
674
674
|
BinaryTree level-order traversal
|
|
675
675
|
|
|
@@ -707,7 +707,7 @@ bfs<C>(
|
|
|
707
707
|
iterationType?): ReturnType<C>[];
|
|
708
708
|
```
|
|
709
709
|
|
|
710
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
710
|
+
Defined in: [data-structures/binary-tree/bst.ts:648](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L648)
|
|
711
711
|
|
|
712
712
|
BinaryTree level-order traversal
|
|
713
713
|
|
|
@@ -769,7 +769,7 @@ IBinaryTree.bfs
|
|
|
769
769
|
ceiling(keyNodeEntryOrPredicate): K | undefined;
|
|
770
770
|
```
|
|
771
771
|
|
|
772
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
772
|
+
Defined in: [data-structures/binary-tree/bst.ts:1900](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1900)
|
|
773
773
|
|
|
774
774
|
Returns the first key with a value >= target.
|
|
775
775
|
Equivalent to Java TreeMap.ceiling.
|
|
@@ -816,7 +816,7 @@ ceiling<C>(
|
|
|
816
816
|
iterationType?): ReturnType<C>;
|
|
817
817
|
```
|
|
818
818
|
|
|
819
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
819
|
+
Defined in: [data-structures/binary-tree/bst.ts:1915](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1915)
|
|
820
820
|
|
|
821
821
|
Returns the first node with a key >= target and applies callback.
|
|
822
822
|
Time Complexity: O(log n) average, O(h) worst case.
|
|
@@ -863,7 +863,7 @@ Space Complexity: O(h) for recursion, O(1) for iteration.
|
|
|
863
863
|
clear(): void;
|
|
864
864
|
```
|
|
865
865
|
|
|
866
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
866
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1579](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1579)
|
|
867
867
|
|
|
868
868
|
Clears the tree of all nodes and values.
|
|
869
869
|
|
|
@@ -904,7 +904,7 @@ IBinaryTree.clear
|
|
|
904
904
|
clone(): this;
|
|
905
905
|
```
|
|
906
906
|
|
|
907
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
907
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2837](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2837)
|
|
908
908
|
|
|
909
909
|
Clones the tree.
|
|
910
910
|
|
|
@@ -1034,7 +1034,7 @@ IBinaryTree.createTree
|
|
|
1034
1034
|
delete(keyNodeOrEntry): boolean;
|
|
1035
1035
|
```
|
|
1036
1036
|
|
|
1037
|
-
Defined in: [data-structures/binary-tree/avl-tree.ts:
|
|
1037
|
+
Defined in: [data-structures/binary-tree/avl-tree.ts:679](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/avl-tree.ts#L679)
|
|
1038
1038
|
|
|
1039
1039
|
Deletes a node from the AVL tree and re-balances the tree.
|
|
1040
1040
|
|
|
@@ -1094,7 +1094,7 @@ deleteWhere(
|
|
|
1094
1094
|
iterationType?): boolean;
|
|
1095
1095
|
```
|
|
1096
1096
|
|
|
1097
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
1097
|
+
Defined in: [data-structures/binary-tree/bst.ts:2764](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2764)
|
|
1098
1098
|
|
|
1099
1099
|
Deletes nodes that match a key, node, entry, predicate, or range.
|
|
1100
1100
|
|
|
@@ -1205,7 +1205,7 @@ The traversal method.
|
|
|
1205
1205
|
dfs(): (K | undefined)[];
|
|
1206
1206
|
```
|
|
1207
1207
|
|
|
1208
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
1208
|
+
Defined in: [data-structures/binary-tree/bst.ts:531](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L531)
|
|
1209
1209
|
|
|
1210
1210
|
Depth-first search traversal
|
|
1211
1211
|
|
|
@@ -1245,7 +1245,7 @@ dfs<C>(
|
|
|
1245
1245
|
iterationType?): ReturnType<C>[];
|
|
1246
1246
|
```
|
|
1247
1247
|
|
|
1248
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
1248
|
+
Defined in: [data-structures/binary-tree/bst.ts:533](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L533)
|
|
1249
1249
|
|
|
1250
1250
|
Depth-first search traversal
|
|
1251
1251
|
|
|
@@ -1435,7 +1435,7 @@ IBinaryTree.every
|
|
|
1435
1435
|
filter(predicate, thisArg?): this;
|
|
1436
1436
|
```
|
|
1437
1437
|
|
|
1438
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
1438
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2896](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2896)
|
|
1439
1439
|
|
|
1440
1440
|
Creates a new tree containing only the entries that satisfy the predicate.
|
|
1441
1441
|
|
|
@@ -1540,7 +1540,7 @@ IBinaryTree.find
|
|
|
1540
1540
|
floor(keyNodeEntryOrPredicate): K | undefined;
|
|
1541
1541
|
```
|
|
1542
1542
|
|
|
1543
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
1543
|
+
Defined in: [data-structures/binary-tree/bst.ts:2125](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2125)
|
|
1544
1544
|
|
|
1545
1545
|
Returns the first key with a value <= target.
|
|
1546
1546
|
Equivalent to Java TreeMap.floor.
|
|
@@ -1587,7 +1587,7 @@ floor<C>(
|
|
|
1587
1587
|
iterationType?): ReturnType<C>;
|
|
1588
1588
|
```
|
|
1589
1589
|
|
|
1590
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
1590
|
+
Defined in: [data-structures/binary-tree/bst.ts:2140](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2140)
|
|
1591
1591
|
|
|
1592
1592
|
Returns the first node with a key <= target and applies callback.
|
|
1593
1593
|
Time Complexity: O(log n) average, O(h) worst case.
|
|
@@ -1681,7 +1681,7 @@ get(
|
|
|
1681
1681
|
iterationType?): V | 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:1405](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1405)
|
|
1685
1685
|
|
|
1686
1686
|
Gets the value associated with a key.
|
|
1687
1687
|
|
|
@@ -1753,7 +1753,7 @@ IBinaryTree.get
|
|
|
1753
1753
|
getByRank(k): K | undefined;
|
|
1754
1754
|
```
|
|
1755
1755
|
|
|
1756
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
1756
|
+
Defined in: [data-structures/binary-tree/bst.ts:1273](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1273)
|
|
1757
1757
|
|
|
1758
1758
|
Returns the element at the k-th position in tree order (0-indexed).
|
|
1759
1759
|
|
|
@@ -1800,7 +1800,7 @@ getByRank<C>(
|
|
|
1800
1800
|
iterationType?): ReturnType<C> | undefined;
|
|
1801
1801
|
```
|
|
1802
1802
|
|
|
1803
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
1803
|
+
Defined in: [data-structures/binary-tree/bst.ts:1284](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1284)
|
|
1804
1804
|
|
|
1805
1805
|
Returns the element at the k-th position in tree order and applies a callback.
|
|
1806
1806
|
|
|
@@ -1852,7 +1852,7 @@ Time O(log n), Space O(1) iterative / O(log n) recursive. Requires `enableOrderS
|
|
|
1852
1852
|
getDepth(dist, startNode?): number;
|
|
1853
1853
|
```
|
|
1854
1854
|
|
|
1855
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
1855
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1801](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1801)
|
|
1856
1856
|
|
|
1857
1857
|
Gets the depth of a node (distance from `startNode`).
|
|
1858
1858
|
|
|
@@ -1916,7 +1916,7 @@ IBinaryTree.getDepth
|
|
|
1916
1916
|
getHeight(startNode?, iterationType?): number;
|
|
1917
1917
|
```
|
|
1918
1918
|
|
|
1919
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
1919
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1872](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1872)
|
|
1920
1920
|
|
|
1921
1921
|
Gets the maximum height of the tree (longest path from startNode to a leaf).
|
|
1922
1922
|
|
|
@@ -1999,7 +1999,7 @@ The traversal method.
|
|
|
1999
1999
|
getLeftMost(): K | undefined;
|
|
2000
2000
|
```
|
|
2001
2001
|
|
|
2002
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
2002
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1999](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1999)
|
|
2003
2003
|
|
|
2004
2004
|
##### Returns
|
|
2005
2005
|
|
|
@@ -2024,7 +2024,7 @@ getLeftMost<C>(
|
|
|
2024
2024
|
iterationType?): ReturnType<C>;
|
|
2025
2025
|
```
|
|
2026
2026
|
|
|
2027
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
2027
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2001](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2001)
|
|
2028
2028
|
|
|
2029
2029
|
##### Type Parameters
|
|
2030
2030
|
|
|
@@ -2071,7 +2071,7 @@ IBinaryTree.getLeftMost
|
|
|
2071
2071
|
getMinHeight(startNode?, iterationType?): number;
|
|
2072
2072
|
```
|
|
2073
2073
|
|
|
2074
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
2074
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1914](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1914)
|
|
2075
2075
|
|
|
2076
2076
|
Gets the minimum height of the tree (shortest path from startNode to a leaf).
|
|
2077
2077
|
|
|
@@ -2123,7 +2123,7 @@ getNode(
|
|
|
2123
2123
|
iterationType?): OptNode<BSTNode<K, V>>;
|
|
2124
2124
|
```
|
|
2125
2125
|
|
|
2126
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
2126
|
+
Defined in: [data-structures/binary-tree/bst.ts:884](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L884)
|
|
2127
2127
|
|
|
2128
2128
|
Gets the first node matching a predicate.
|
|
2129
2129
|
|
|
@@ -2196,7 +2196,7 @@ getNodes(
|
|
|
2196
2196
|
iterationType?): BinaryTreeNode<K, V>[];
|
|
2197
2197
|
```
|
|
2198
2198
|
|
|
2199
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
2199
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1247](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1247)
|
|
2200
2200
|
|
|
2201
2201
|
Gets all nodes matching a predicate.
|
|
2202
2202
|
|
|
@@ -2291,7 +2291,7 @@ If true, returns the path from root-to-node.
|
|
|
2291
2291
|
getPathToRoot(beginNode): (K | undefined)[];
|
|
2292
2292
|
```
|
|
2293
2293
|
|
|
2294
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
2294
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1961](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1961)
|
|
2295
2295
|
|
|
2296
2296
|
##### Parameters
|
|
2297
2297
|
|
|
@@ -2326,7 +2326,7 @@ getPathToRoot<C>(
|
|
|
2326
2326
|
isReverse?): ReturnType<C>[];
|
|
2327
2327
|
```
|
|
2328
2328
|
|
|
2329
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
2329
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1965](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1965)
|
|
2330
2330
|
|
|
2331
2331
|
##### Type Parameters
|
|
2332
2332
|
|
|
@@ -2374,7 +2374,7 @@ IBinaryTree.getPathToRoot
|
|
|
2374
2374
|
getPredecessor(node): BinaryTreeNode<K, V>;
|
|
2375
2375
|
```
|
|
2376
2376
|
|
|
2377
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
2377
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2099](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2099)
|
|
2378
2378
|
|
|
2379
2379
|
Gets the Morris traversal predecessor (rightmost node in the left subtree, or node itself).
|
|
2380
2380
|
|
|
@@ -2410,7 +2410,7 @@ This is primarily a helper for Morris traversal. Time O(H), where H is the heigh
|
|
|
2410
2410
|
getRank(keyNodeEntryOrPredicate): number;
|
|
2411
2411
|
```
|
|
2412
2412
|
|
|
2413
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
2413
|
+
Defined in: [data-structures/binary-tree/bst.ts:1328](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1328)
|
|
2414
2414
|
|
|
2415
2415
|
Returns the 0-based rank of a key (number of elements that precede it in tree order).
|
|
2416
2416
|
|
|
@@ -2448,7 +2448,7 @@ Tree order is defined by the comparator. When the key is not found, returns the
|
|
|
2448
2448
|
getRank(keyNodeEntryOrPredicate, iterationType): number;
|
|
2449
2449
|
```
|
|
2450
2450
|
|
|
2451
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
2451
|
+
Defined in: [data-structures/binary-tree/bst.ts:1346](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1346)
|
|
2452
2452
|
|
|
2453
2453
|
Returns the 0-based rank (number of preceding elements in tree order) with explicit iteration type.
|
|
2454
2454
|
|
|
@@ -2517,7 +2517,7 @@ The traversal method.
|
|
|
2517
2517
|
getRightMost(): K | undefined;
|
|
2518
2518
|
```
|
|
2519
2519
|
|
|
2520
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
2520
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2046](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2046)
|
|
2521
2521
|
|
|
2522
2522
|
##### Returns
|
|
2523
2523
|
|
|
@@ -2542,7 +2542,7 @@ getRightMost<C>(
|
|
|
2542
2542
|
iterationType?): ReturnType<C>;
|
|
2543
2543
|
```
|
|
2544
2544
|
|
|
2545
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
2545
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2048](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2048)
|
|
2546
2546
|
|
|
2547
2547
|
##### Type Parameters
|
|
2548
2548
|
|
|
@@ -2589,7 +2589,7 @@ IBinaryTree.getRightMost
|
|
|
2589
2589
|
getSuccessor(x?): BinaryTreeNode<K, V> | null | undefined;
|
|
2590
2590
|
```
|
|
2591
2591
|
|
|
2592
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
2592
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2120](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2120)
|
|
2593
2593
|
|
|
2594
2594
|
Gets the in-order successor of a node in a BST.
|
|
2595
2595
|
|
|
@@ -2626,7 +2626,7 @@ has(
|
|
|
2626
2626
|
iterationType?): boolean;
|
|
2627
2627
|
```
|
|
2628
2628
|
|
|
2629
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
2629
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1497](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1497)
|
|
2630
2630
|
|
|
2631
2631
|
Checks if a node matching the predicate exists in the tree.
|
|
2632
2632
|
|
|
@@ -2761,7 +2761,7 @@ IBinaryTree.hasValue
|
|
|
2761
2761
|
higher(keyNodeEntryOrPredicate): K | undefined;
|
|
2762
2762
|
```
|
|
2763
2763
|
|
|
2764
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
2764
|
+
Defined in: [data-structures/binary-tree/bst.ts:2012](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2012)
|
|
2765
2765
|
|
|
2766
2766
|
Returns the first key with a value > target.
|
|
2767
2767
|
Equivalent to Java TreeMap.higher.
|
|
@@ -2807,7 +2807,7 @@ higher<C>(
|
|
|
2807
2807
|
iterationType?): ReturnType<C>;
|
|
2808
2808
|
```
|
|
2809
2809
|
|
|
2810
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
2810
|
+
Defined in: [data-structures/binary-tree/bst.ts:2027](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2027)
|
|
2811
2811
|
|
|
2812
2812
|
Returns the first node with a key > target and applies callback.
|
|
2813
2813
|
Time Complexity: O(log n) average, O(h) worst case.
|
|
@@ -2854,7 +2854,7 @@ Space Complexity: O(h) for recursion, O(1) for iteration.
|
|
|
2854
2854
|
isAVLBalanced(iterationType?): boolean;
|
|
2855
2855
|
```
|
|
2856
2856
|
|
|
2857
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
2857
|
+
Defined in: [data-structures/binary-tree/bst.ts:2571](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2571)
|
|
2858
2858
|
|
|
2859
2859
|
Checks if the tree meets the AVL balance condition (height difference <= 1).
|
|
2860
2860
|
|
|
@@ -2898,7 +2898,7 @@ Time O(N), as it must visit every node to compute height. Space O(log N) for rec
|
|
|
2898
2898
|
isBST(startNode?, iterationType?): boolean;
|
|
2899
2899
|
```
|
|
2900
2900
|
|
|
2901
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
2901
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1703](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1703)
|
|
2902
2902
|
|
|
2903
2903
|
Checks if the tree is a valid Binary Search Tree (BST).
|
|
2904
2904
|
|
|
@@ -2958,7 +2958,7 @@ IBinaryTree.isBST
|
|
|
2958
2958
|
isEmpty(): boolean;
|
|
2959
2959
|
```
|
|
2960
2960
|
|
|
2961
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
2961
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1633](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1633)
|
|
2962
2962
|
|
|
2963
2963
|
Checks if the tree is empty.
|
|
2964
2964
|
|
|
@@ -3151,7 +3151,7 @@ Time O(1), Space O(1)
|
|
|
3151
3151
|
isPerfectlyBalanced(startNode?): boolean;
|
|
3152
3152
|
```
|
|
3153
3153
|
|
|
3154
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
3154
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:1644](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1644)
|
|
3155
3155
|
|
|
3156
3156
|
Checks if the tree is perfectly balanced.
|
|
3157
3157
|
|
|
@@ -3439,7 +3439,7 @@ The traversal method.
|
|
|
3439
3439
|
leaves(): (K | undefined)[];
|
|
3440
3440
|
```
|
|
3441
3441
|
|
|
3442
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
3442
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2435](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2435)
|
|
3443
3443
|
|
|
3444
3444
|
Get leaf nodes
|
|
3445
3445
|
|
|
@@ -3477,7 +3477,7 @@ leaves<C>(
|
|
|
3477
3477
|
iterationType?): ReturnType<C>[];
|
|
3478
3478
|
```
|
|
3479
3479
|
|
|
3480
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
3480
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2437](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2437)
|
|
3481
3481
|
|
|
3482
3482
|
Get leaf nodes
|
|
3483
3483
|
|
|
@@ -3565,7 +3565,7 @@ The traversal method.
|
|
|
3565
3565
|
lesserOrGreaterTraverse(): (K | undefined)[];
|
|
3566
3566
|
```
|
|
3567
3567
|
|
|
3568
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
3568
|
+
Defined in: [data-structures/binary-tree/bst.ts:2383](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2383)
|
|
3569
3569
|
|
|
3570
3570
|
##### Returns
|
|
3571
3571
|
|
|
@@ -3585,7 +3585,7 @@ lesserOrGreaterTraverse<C>(
|
|
|
3585
3585
|
iterationType?): ReturnType<C>[];
|
|
3586
3586
|
```
|
|
3587
3587
|
|
|
3588
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
3588
|
+
Defined in: [data-structures/binary-tree/bst.ts:2385](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2385)
|
|
3589
3589
|
|
|
3590
3590
|
##### Type Parameters
|
|
3591
3591
|
|
|
@@ -3654,7 +3654,7 @@ The traversal method.
|
|
|
3654
3654
|
listLevels(): (K | undefined)[][];
|
|
3655
3655
|
```
|
|
3656
3656
|
|
|
3657
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
3657
|
+
Defined in: [data-structures/binary-tree/bst.ts:762](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L762)
|
|
3658
3658
|
|
|
3659
3659
|
Level-order grouping
|
|
3660
3660
|
|
|
@@ -3695,7 +3695,7 @@ listLevels<C>(
|
|
|
3695
3695
|
iterationType?): ReturnType<C>[][];
|
|
3696
3696
|
```
|
|
3697
3697
|
|
|
3698
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
3698
|
+
Defined in: [data-structures/binary-tree/bst.ts:764](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L764)
|
|
3699
3699
|
|
|
3700
3700
|
Level-order grouping
|
|
3701
3701
|
|
|
@@ -3760,7 +3760,7 @@ IBinaryTree.listLevels
|
|
|
3760
3760
|
lower(keyNodeEntryOrPredicate): K | undefined;
|
|
3761
3761
|
```
|
|
3762
3762
|
|
|
3763
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
3763
|
+
Defined in: [data-structures/binary-tree/bst.ts:2280](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2280)
|
|
3764
3764
|
|
|
3765
3765
|
Returns the first key with a value < target.
|
|
3766
3766
|
Equivalent to Java TreeMap.lower.
|
|
@@ -3806,7 +3806,7 @@ lower<C>(
|
|
|
3806
3806
|
iterationType?): ReturnType<C>;
|
|
3807
3807
|
```
|
|
3808
3808
|
|
|
3809
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
3809
|
+
Defined in: [data-structures/binary-tree/bst.ts:2295](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2295)
|
|
3810
3810
|
|
|
3811
3811
|
Returns the first node with a key < target and applies callback.
|
|
3812
3812
|
Time Complexity: O(log n) average, O(h) worst case.
|
|
@@ -3856,7 +3856,7 @@ map<MK, MV, MR>(
|
|
|
3856
3856
|
thisArg?): AVLTree<MK, MV, MR>;
|
|
3857
3857
|
```
|
|
3858
3858
|
|
|
3859
|
-
Defined in: [data-structures/binary-tree/avl-tree.ts:
|
|
3859
|
+
Defined in: [data-structures/binary-tree/avl-tree.ts:943](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/avl-tree.ts#L943)
|
|
3860
3860
|
|
|
3861
3861
|
Creates a new AVLTree by mapping each [key, value] pair.
|
|
3862
3862
|
|
|
@@ -3939,7 +3939,7 @@ IBinaryTree.map
|
|
|
3939
3939
|
merge(anotherTree): void;
|
|
3940
3940
|
```
|
|
3941
3941
|
|
|
3942
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
3942
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:937](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L937)
|
|
3943
3943
|
|
|
3944
3944
|
Merges another tree into this one by seting all its nodes.
|
|
3945
3945
|
|
|
@@ -4013,7 +4013,7 @@ The node to start from.
|
|
|
4013
4013
|
morris(): (K | undefined)[];
|
|
4014
4014
|
```
|
|
4015
4015
|
|
|
4016
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
4016
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2667](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2667)
|
|
4017
4017
|
|
|
4018
4018
|
Morris traversal (O(1) space)
|
|
4019
4019
|
|
|
@@ -4051,7 +4051,7 @@ morris<C>(
|
|
|
4051
4051
|
startNode?): ReturnType<C>[];
|
|
4052
4052
|
```
|
|
4053
4053
|
|
|
4054
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
4054
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2669](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2669)
|
|
4055
4055
|
|
|
4056
4056
|
Morris traversal (O(1) space)
|
|
4057
4057
|
|
|
@@ -4111,7 +4111,7 @@ IBinaryTree.morris
|
|
|
4111
4111
|
perfectlyBalance(iterationType?): boolean;
|
|
4112
4112
|
```
|
|
4113
4113
|
|
|
4114
|
-
Defined in: [data-structures/binary-tree/avl-tree.ts:
|
|
4114
|
+
Defined in: [data-structures/binary-tree/avl-tree.ts:782](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/avl-tree.ts#L782)
|
|
4115
4115
|
|
|
4116
4116
|
Rebuilds the tree to be perfectly balanced.
|
|
4117
4117
|
|
|
@@ -4160,7 +4160,7 @@ Time O(N) (O(N) for DFS, O(N) for sorted build). Space O(N) for node array and r
|
|
|
4160
4160
|
print(options?, startNode?): void;
|
|
4161
4161
|
```
|
|
4162
4162
|
|
|
4163
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
4163
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3056](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3056)
|
|
4164
4164
|
|
|
4165
4165
|
Prints a visual representation of the tree to the console.
|
|
4166
4166
|
|
|
@@ -4213,7 +4213,7 @@ Time O(N) (via `toVisual`). Space O(N*H) or O(N^2) (via `toVisual`).
|
|
|
4213
4213
|
rangeByRank(start, end): (K | undefined)[];
|
|
4214
4214
|
```
|
|
4215
4215
|
|
|
4216
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
4216
|
+
Defined in: [data-structures/binary-tree/bst.ts:1408](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1408)
|
|
4217
4217
|
|
|
4218
4218
|
Returns elements by position range in tree order (0-indexed, inclusive on both ends).
|
|
4219
4219
|
|
|
@@ -4255,7 +4255,7 @@ rangeByRank<C>(
|
|
|
4255
4255
|
iterationType?): ReturnType<C>[];
|
|
4256
4256
|
```
|
|
4257
4257
|
|
|
4258
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
4258
|
+
Defined in: [data-structures/binary-tree/bst.ts:1420](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1420)
|
|
4259
4259
|
|
|
4260
4260
|
Returns elements by position range in tree order with callback and optional iteration type.
|
|
4261
4261
|
|
|
@@ -4341,7 +4341,7 @@ The traversal method.
|
|
|
4341
4341
|
rangeSearch(range): (K | undefined)[];
|
|
4342
4342
|
```
|
|
4343
4343
|
|
|
4344
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
4344
|
+
Defined in: [data-structures/binary-tree/bst.ts:1227](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1227)
|
|
4345
4345
|
|
|
4346
4346
|
Find all keys in a range
|
|
4347
4347
|
|
|
@@ -4379,7 +4379,7 @@ rangeSearch<C>(
|
|
|
4379
4379
|
iterationType?): ReturnType<C>[];
|
|
4380
4380
|
```
|
|
4381
4381
|
|
|
4382
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
4382
|
+
Defined in: [data-structures/binary-tree/bst.ts:1229](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1229)
|
|
4383
4383
|
|
|
4384
4384
|
Find all keys in a range
|
|
4385
4385
|
|
|
@@ -4522,7 +4522,7 @@ Whether to use 'RECURSIVE' or 'ITERATIVE' search.
|
|
|
4522
4522
|
search(keyNodeEntryOrPredicate, onlyOne?): (K | undefined)[];
|
|
4523
4523
|
```
|
|
4524
4524
|
|
|
4525
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
4525
|
+
Defined in: [data-structures/binary-tree/bst.ts:1026](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1026)
|
|
4526
4526
|
|
|
4527
4527
|
Search nodes by predicate
|
|
4528
4528
|
|
|
@@ -4578,7 +4578,7 @@ search<C>(
|
|
|
4578
4578
|
iterationType?): ReturnType<C>[];
|
|
4579
4579
|
```
|
|
4580
4580
|
|
|
4581
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
4581
|
+
Defined in: [data-structures/binary-tree/bst.ts:1038](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1038)
|
|
4582
4582
|
|
|
4583
4583
|
Search nodes by predicate
|
|
4584
4584
|
|
|
@@ -4652,7 +4652,7 @@ IBinaryTree.search
|
|
|
4652
4652
|
set(keyNodeOrEntry, value?): boolean;
|
|
4653
4653
|
```
|
|
4654
4654
|
|
|
4655
|
-
Defined in: [data-structures/binary-tree/avl-tree.ts:
|
|
4655
|
+
Defined in: [data-structures/binary-tree/avl-tree.ts:529](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/avl-tree.ts#L529)
|
|
4656
4656
|
|
|
4657
4657
|
Sets a new node to the AVL tree and balances the tree path.
|
|
4658
4658
|
|
|
@@ -4718,7 +4718,7 @@ setMany(
|
|
|
4718
4718
|
iterationType?): boolean[];
|
|
4719
4719
|
```
|
|
4720
4720
|
|
|
4721
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
4721
|
+
Defined in: [data-structures/binary-tree/bst.ts:1754](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1754)
|
|
4722
4722
|
|
|
4723
4723
|
Adds multiple items to the tree.
|
|
4724
4724
|
|
|
@@ -4856,7 +4856,7 @@ Time O(n), Space O(n)
|
|
|
4856
4856
|
toVisual(startNode?, options?): string;
|
|
4857
4857
|
```
|
|
4858
4858
|
|
|
4859
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
4859
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:2979](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2979)
|
|
4860
4860
|
|
|
4861
4861
|
Generates a string representation of the tree for visualization.
|
|
4862
4862
|
|
|
@@ -4954,7 +4954,7 @@ Time O(1) Space O(1)
|
|
|
4954
4954
|
protected readonly _DEFAULT_NODE_CALLBACK: NodeCallback<BinaryTreeNode<K, V> | null | undefined, K | undefined>;
|
|
4955
4955
|
```
|
|
4956
4956
|
|
|
4957
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
4957
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3252](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3252)
|
|
4958
4958
|
|
|
4959
4959
|
(Protected) Default callback function, returns the node's key.
|
|
4960
4960
|
|
|
@@ -4982,7 +4982,7 @@ The node's key or undefined.
|
|
|
4982
4982
|
protected _balanceFactor(node): number;
|
|
4983
4983
|
```
|
|
4984
4984
|
|
|
4985
|
-
Defined in: [data-structures/binary-tree/avl-tree.ts:
|
|
4985
|
+
Defined in: [data-structures/binary-tree/avl-tree.ts:1041](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/avl-tree.ts#L1041)
|
|
4986
4986
|
|
|
4987
4987
|
(Protected) Calculates the balance factor (height(right) - height(left)).
|
|
4988
4988
|
|
|
@@ -5012,7 +5012,7 @@ Time O(1) (assumes heights are stored).
|
|
|
5012
5012
|
protected _balanceLL(A): void;
|
|
5013
5013
|
```
|
|
5014
5014
|
|
|
5015
|
-
Defined in: [data-structures/binary-tree/avl-tree.ts:
|
|
5015
|
+
Defined in: [data-structures/binary-tree/avl-tree.ts:1065](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/avl-tree.ts#L1065)
|
|
5016
5016
|
|
|
5017
5017
|
(Protected) Performs a Left-Left (LL) rotation (a single right rotation).
|
|
5018
5018
|
|
|
@@ -5040,7 +5040,7 @@ Time O(1), Space O(1)
|
|
|
5040
5040
|
protected _balanceLR(A): void;
|
|
5041
5041
|
```
|
|
5042
5042
|
|
|
5043
|
-
Defined in: [data-structures/binary-tree/avl-tree.ts:
|
|
5043
|
+
Defined in: [data-structures/binary-tree/avl-tree.ts:1102](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/avl-tree.ts#L1102)
|
|
5044
5044
|
|
|
5045
5045
|
(Protected) Performs a Left-Right (LR) double rotation.
|
|
5046
5046
|
|
|
@@ -5068,7 +5068,7 @@ Time O(1), Space O(1)
|
|
|
5068
5068
|
protected _balancePath(node): void;
|
|
5069
5069
|
```
|
|
5070
5070
|
|
|
5071
|
-
Defined in: [data-structures/binary-tree/avl-tree.ts:
|
|
5071
|
+
Defined in: [data-structures/binary-tree/avl-tree.ts:1252](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/avl-tree.ts#L1252)
|
|
5072
5072
|
|
|
5073
5073
|
(Protected) Traverses up the tree from the specified node, updating heights and performing rotations as needed.
|
|
5074
5074
|
|
|
@@ -5100,7 +5100,7 @@ Time O(log N) (O(H)), as it traverses the path to root. Space O(H) for the path
|
|
|
5100
5100
|
protected _balanceRL(A): void;
|
|
5101
5101
|
```
|
|
5102
5102
|
|
|
5103
|
-
Defined in: [data-structures/binary-tree/avl-tree.ts:
|
|
5103
|
+
Defined in: [data-structures/binary-tree/avl-tree.ts:1198](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/avl-tree.ts#L1198)
|
|
5104
5104
|
|
|
5105
5105
|
(Protected) Performs a Right-Left (RL) double rotation.
|
|
5106
5106
|
|
|
@@ -5128,7 +5128,7 @@ Time O(1), Space O(1)
|
|
|
5128
5128
|
protected _balanceRR(A): void;
|
|
5129
5129
|
```
|
|
5130
5130
|
|
|
5131
|
-
Defined in: [data-structures/binary-tree/avl-tree.ts:
|
|
5131
|
+
Defined in: [data-structures/binary-tree/avl-tree.ts:1157](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/avl-tree.ts#L1157)
|
|
5132
5132
|
|
|
5133
5133
|
(Protected) Performs a Right-Right (RR) rotation (a single left rotation).
|
|
5134
5134
|
|
|
@@ -5159,7 +5159,7 @@ protected _bound(
|
|
|
5159
5159
|
iterationType): BSTNode<K, V> | undefined;
|
|
5160
5160
|
```
|
|
5161
5161
|
|
|
5162
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
5162
|
+
Defined in: [data-structures/binary-tree/bst.ts:3065](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3065)
|
|
5163
5163
|
|
|
5164
5164
|
(Protected) Core bound search implementation supporting all parameter types.
|
|
5165
5165
|
Unified logic for both lowerBound and upperBound.
|
|
@@ -5211,7 +5211,7 @@ protected _boundByKey(
|
|
|
5211
5211
|
iterationType): BSTNode<K, V> | undefined;
|
|
5212
5212
|
```
|
|
5213
5213
|
|
|
5214
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
5214
|
+
Defined in: [data-structures/binary-tree/bst.ts:3122](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3122)
|
|
5215
5215
|
|
|
5216
5216
|
(Protected) Binary search for bound by key with pruning optimization.
|
|
5217
5217
|
Performs standard BST binary search, choosing left or right subtree based on comparator result.
|
|
@@ -5256,7 +5256,7 @@ The first node matching the bound condition, or undefined if none exists.
|
|
|
5256
5256
|
protected _boundByPredicate(predicate, iterationType): BSTNode<K, V> | undefined;
|
|
5257
5257
|
```
|
|
5258
5258
|
|
|
5259
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
5259
|
+
Defined in: [data-structures/binary-tree/bst.ts:3177](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3177)
|
|
5260
5260
|
|
|
5261
5261
|
(Protected) In-order traversal search by predicate.
|
|
5262
5262
|
Falls back to linear in-order traversal when predicate-based search is required.
|
|
@@ -5296,7 +5296,7 @@ The first node satisfying predicate, or undefined if none found.
|
|
|
5296
5296
|
protected _clearNodes(): void;
|
|
5297
5297
|
```
|
|
5298
5298
|
|
|
5299
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
5299
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3686](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3686)
|
|
5300
5300
|
|
|
5301
5301
|
(Protected) Clears all nodes from the tree.
|
|
5302
5302
|
|
|
@@ -5320,7 +5320,7 @@ Time O(1)
|
|
|
5320
5320
|
protected _clearValues(): void;
|
|
5321
5321
|
```
|
|
5322
5322
|
|
|
5323
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
5323
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3695](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3695)
|
|
5324
5324
|
|
|
5325
5325
|
(Protected) Clears all values from the external store.
|
|
5326
5326
|
|
|
@@ -5344,7 +5344,7 @@ Time O(N)
|
|
|
5344
5344
|
protected _clone(cloned): void;
|
|
5345
5345
|
```
|
|
5346
5346
|
|
|
5347
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
5347
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3345](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3345)
|
|
5348
5348
|
|
|
5349
5349
|
(Protected) Helper for cloning. Performs a BFS and sets all nodes to the new tree.
|
|
5350
5350
|
|
|
@@ -5376,7 +5376,7 @@ Time O(N * M) (O(N) BFS + O(M) `set` for each node).
|
|
|
5376
5376
|
protected _compare(a, b): number;
|
|
5377
5377
|
```
|
|
5378
5378
|
|
|
5379
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
5379
|
+
Defined in: [data-structures/binary-tree/bst.ts:3441](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3441)
|
|
5380
5380
|
|
|
5381
5381
|
(Protected) Compares two keys using the tree's comparator and reverse setting.
|
|
5382
5382
|
|
|
@@ -5416,7 +5416,7 @@ Time O(1) Space O(1)
|
|
|
5416
5416
|
protected _createDefaultComparator(): Comparator<K>;
|
|
5417
5417
|
```
|
|
5418
5418
|
|
|
5419
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
5419
|
+
Defined in: [data-structures/binary-tree/bst.ts:2792](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2792)
|
|
5420
5420
|
|
|
5421
5421
|
(Protected) Creates the default comparator function for keys that don't have a custom comparator.
|
|
5422
5422
|
|
|
@@ -5442,7 +5442,7 @@ Time O(1) Space O(1)
|
|
|
5442
5442
|
protected _createInstance<TK, TV, TR>(options?): this;
|
|
5443
5443
|
```
|
|
5444
5444
|
|
|
5445
|
-
Defined in: [data-structures/binary-tree/avl-tree.ts:
|
|
5445
|
+
Defined in: [data-structures/binary-tree/avl-tree.ts:967](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/avl-tree.ts#L967)
|
|
5446
5446
|
|
|
5447
5447
|
(Protected) Creates a new, empty instance of the same AVLTree constructor.
|
|
5448
5448
|
|
|
@@ -5490,7 +5490,7 @@ Time O(1)
|
|
|
5490
5490
|
protected _createLike<TK, TV, TR>(iter?, options?): AVLTree<TK, TV, TR>;
|
|
5491
5491
|
```
|
|
5492
5492
|
|
|
5493
|
-
Defined in: [data-structures/binary-tree/avl-tree.ts:
|
|
5493
|
+
Defined in: [data-structures/binary-tree/avl-tree.ts:984](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/avl-tree.ts#L984)
|
|
5494
5494
|
|
|
5495
5495
|
(Protected) Creates a new instance of the same AVLTree constructor, potentially with different generic types.
|
|
5496
5496
|
|
|
@@ -5550,7 +5550,7 @@ Time O(N log N) (from constructor) due to processing the iterable.
|
|
|
5550
5550
|
protected _deleteByKey(key): boolean;
|
|
5551
5551
|
```
|
|
5552
5552
|
|
|
5553
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
5553
|
+
Defined in: [data-structures/binary-tree/bst.ts:3452](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3452)
|
|
5554
5554
|
|
|
5555
5555
|
(Private) Deletes a node by its key.
|
|
5556
5556
|
|
|
@@ -5584,7 +5584,7 @@ Standard BST deletion algorithm. Time O(log N), O(N) worst-case. Space O(1).
|
|
|
5584
5584
|
protected _deleteInternal(keyNodeEntryRawOrPredicate): BinaryTreeDeleteResult<BinaryTreeNode<K, V>>[];
|
|
5585
5585
|
```
|
|
5586
5586
|
|
|
5587
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
5587
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:949](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L949)
|
|
5588
5588
|
|
|
5589
5589
|
**`Internal`**
|
|
5590
5590
|
|
|
@@ -5632,7 +5632,7 @@ protected _dfs<C>(
|
|
|
5632
5632
|
shouldProcessRoot?): ReturnType<C>[];
|
|
5633
5633
|
```
|
|
5634
5634
|
|
|
5635
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
5635
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3063](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3063)
|
|
5636
5636
|
|
|
5637
5637
|
#### Type Parameters
|
|
5638
5638
|
|
|
@@ -5725,7 +5725,7 @@ Array of callback results.
|
|
|
5725
5725
|
protected _displayAux(node, options): NodeDisplayLayout;
|
|
5726
5726
|
```
|
|
5727
5727
|
|
|
5728
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
5728
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3369](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3369)
|
|
5729
5729
|
|
|
5730
5730
|
(Protected) Recursive helper for `toVisual`.
|
|
5731
5731
|
|
|
@@ -5765,7 +5765,7 @@ Time O(N), Space O(N*H) or O(N^2)
|
|
|
5765
5765
|
protected _ensurePredicate(keyNodeEntryOrPredicate): NodePredicate<BinaryTreeNode<K, V>>;
|
|
5766
5766
|
```
|
|
5767
5767
|
|
|
5768
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
5768
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3592](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3592)
|
|
5769
5769
|
|
|
5770
5770
|
(Protected) Converts a key, node, entry, or predicate into a standardized predicate function.
|
|
5771
5771
|
|
|
@@ -5804,7 +5804,7 @@ Time O(1)
|
|
|
5804
5804
|
protected _extractKey(keyNodeOrEntry): K | null | undefined;
|
|
5805
5805
|
```
|
|
5806
5806
|
|
|
5807
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
5807
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3652](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3652)
|
|
5808
5808
|
|
|
5809
5809
|
(Protected) Extracts the key from a key, node, or entry.
|
|
5810
5810
|
|
|
@@ -5842,7 +5842,7 @@ Time O(1)
|
|
|
5842
5842
|
protected _floorByKey(key, iterationType): BSTNode<K, V> | undefined;
|
|
5843
5843
|
```
|
|
5844
5844
|
|
|
5845
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
5845
|
+
Defined in: [data-structures/binary-tree/bst.ts:2830](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2830)
|
|
5846
5846
|
|
|
5847
5847
|
(Protected) Binary search for floor by key with pruning optimization.
|
|
5848
5848
|
Performs standard BST binary search, choosing left or right subtree based on comparator result.
|
|
@@ -5884,7 +5884,7 @@ Time O(h) where h is tree height.
|
|
|
5884
5884
|
protected _floorByPredicate(predicate, iterationType): BSTNode<K, V> | undefined;
|
|
5885
5885
|
```
|
|
5886
5886
|
|
|
5887
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
5887
|
+
Defined in: [data-structures/binary-tree/bst.ts:2883](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2883)
|
|
5888
5888
|
|
|
5889
5889
|
(Protected) In-order traversal search for floor by predicate.
|
|
5890
5890
|
Falls back to linear in-order traversal when predicate-based search is required.
|
|
@@ -5927,7 +5927,7 @@ Space Complexity: O(h) for recursion, O(h) for iterative stack.
|
|
|
5927
5927
|
protected _getByRankIterative(node, k): BSTNode<K, V> | undefined;
|
|
5928
5928
|
```
|
|
5929
5929
|
|
|
5930
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
5930
|
+
Defined in: [data-structures/binary-tree/bst.ts:3333](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3333)
|
|
5931
5931
|
|
|
5932
5932
|
(Protected) Finds the node at position k in tree order (iterative).
|
|
5933
5933
|
|
|
@@ -5961,7 +5961,7 @@ Time O(log n), Space O(1)
|
|
|
5961
5961
|
protected _getByRankRecursive(node, k): BSTNode<K, V> | undefined;
|
|
5962
5962
|
```
|
|
5963
5963
|
|
|
5964
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
5964
|
+
Defined in: [data-structures/binary-tree/bst.ts:3354](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3354)
|
|
5965
5965
|
|
|
5966
5966
|
(Protected) Finds the node at position k in tree order (recursive).
|
|
5967
5967
|
|
|
@@ -5995,7 +5995,7 @@ Time O(log n), Space O(log n) call stack
|
|
|
5995
5995
|
protected _getIterator(node?): IterableIterator<[K, V | undefined]>;
|
|
5996
5996
|
```
|
|
5997
5997
|
|
|
5998
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
5998
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3208](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3208)
|
|
5999
5999
|
|
|
6000
6000
|
(Protected) Gets the iterator for the tree (default in-order).
|
|
6001
6001
|
|
|
@@ -6029,7 +6029,7 @@ Time O(N) for full iteration. O(H) to get the first element. Space O(H) for the
|
|
|
6029
6029
|
protected _getRankIterative(node, key): number;
|
|
6030
6030
|
```
|
|
6031
6031
|
|
|
6032
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
6032
|
+
Defined in: [data-structures/binary-tree/bst.ts:3366](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3366)
|
|
6033
6033
|
|
|
6034
6034
|
(Protected) Computes the rank of a key iteratively.
|
|
6035
6035
|
|
|
@@ -6063,7 +6063,7 @@ Time O(log n), Space O(1)
|
|
|
6063
6063
|
protected _getRankRecursive(node, key): number;
|
|
6064
6064
|
```
|
|
6065
6065
|
|
|
6066
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
6066
|
+
Defined in: [data-structures/binary-tree/bst.ts:3392](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3392)
|
|
6067
6067
|
|
|
6068
6068
|
(Protected) Computes the rank of a key recursively.
|
|
6069
6069
|
|
|
@@ -6097,7 +6097,7 @@ Time O(log n), Space O(log n) call stack
|
|
|
6097
6097
|
protected _isDisplayLeaf(node, options): boolean;
|
|
6098
6098
|
```
|
|
6099
6099
|
|
|
6100
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
6100
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3464](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3464)
|
|
6101
6101
|
|
|
6102
6102
|
Check if a node is a display leaf (empty, null, undefined, NIL, or real leaf).
|
|
6103
6103
|
|
|
@@ -6127,7 +6127,7 @@ Check if a node is a display leaf (empty, null, undefined, NIL, or real leaf).
|
|
|
6127
6127
|
protected _isPredicate(p): p is NodePredicate<BinaryTreeNode<K, V>>;
|
|
6128
6128
|
```
|
|
6129
6129
|
|
|
6130
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
6130
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3641](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3641)
|
|
6131
6131
|
|
|
6132
6132
|
(Protected) Checks if an item is a predicate function.
|
|
6133
6133
|
|
|
@@ -6161,7 +6161,7 @@ Time O(1)
|
|
|
6161
6161
|
protected _keyValueNodeOrEntryToNodeAndValue(keyNodeOrEntry, value?): [OptNode<BSTNode<K, V>>, V | undefined];
|
|
6162
6162
|
```
|
|
6163
6163
|
|
|
6164
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
6164
|
+
Defined in: [data-structures/binary-tree/bst.ts:3290](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3290)
|
|
6165
6165
|
|
|
6166
6166
|
(Protected) Converts a key, node, or entry into a standardized [node, value] tuple.
|
|
6167
6167
|
|
|
@@ -6205,7 +6205,7 @@ Time O(1)
|
|
|
6205
6205
|
protected _lowerByKey(key, iterationType): BSTNode<K, V> | undefined;
|
|
6206
6206
|
```
|
|
6207
6207
|
|
|
6208
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
6208
|
+
Defined in: [data-structures/binary-tree/bst.ts:2948](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2948)
|
|
6209
6209
|
|
|
6210
6210
|
(Protected) Binary search for lower by key with pruning optimization.
|
|
6211
6211
|
Performs standard BST binary search, choosing left or right subtree based on comparator result.
|
|
@@ -6247,7 +6247,7 @@ Time O(h) where h is tree height.
|
|
|
6247
6247
|
protected _lowerByPredicate(predicate, iterationType): BSTNode<K, V> | undefined;
|
|
6248
6248
|
```
|
|
6249
6249
|
|
|
6250
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
6250
|
+
Defined in: [data-structures/binary-tree/bst.ts:3001](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3001)
|
|
6251
6251
|
|
|
6252
6252
|
(Protected) In-order traversal search for lower by predicate.
|
|
6253
6253
|
Falls back to linear in-order traversal when predicate-based search is required.
|
|
@@ -6290,7 +6290,7 @@ Space Complexity: O(h) for recursion, O(h) for iterative stack.
|
|
|
6290
6290
|
protected _next(node): BSTNode<K, V> | undefined;
|
|
6291
6291
|
```
|
|
6292
6292
|
|
|
6293
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
6293
|
+
Defined in: [data-structures/binary-tree/bst.ts:3409](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3409)
|
|
6294
6294
|
|
|
6295
6295
|
(Protected) Finds the in-order successor of a node.
|
|
6296
6296
|
|
|
@@ -6320,7 +6320,7 @@ Time O(log n), Space O(1)
|
|
|
6320
6320
|
protected _replaceNode(oldNode, newNode): AVLTreeNode<K, V>;
|
|
6321
6321
|
```
|
|
6322
6322
|
|
|
6323
|
-
Defined in: [data-structures/binary-tree/avl-tree.ts:
|
|
6323
|
+
Defined in: [data-structures/binary-tree/avl-tree.ts:1300](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/avl-tree.ts#L1300)
|
|
6324
6324
|
|
|
6325
6325
|
(Protected) Replaces a node, ensuring height is copied.
|
|
6326
6326
|
|
|
@@ -6363,7 +6363,7 @@ protected _resolveDisplayLeaf(
|
|
|
6363
6363
|
emptyDisplayLayout): NodeDisplayLayout;
|
|
6364
6364
|
```
|
|
6365
6365
|
|
|
6366
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
6366
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3494](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3494)
|
|
6367
6367
|
|
|
6368
6368
|
Resolve a display leaf node to its layout.
|
|
6369
6369
|
|
|
@@ -6397,7 +6397,7 @@ Resolve a display leaf node to its layout.
|
|
|
6397
6397
|
protected _setRoot(v): void;
|
|
6398
6398
|
```
|
|
6399
6399
|
|
|
6400
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
6400
|
+
Defined in: [data-structures/binary-tree/bst.ts:3428](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3428)
|
|
6401
6401
|
|
|
6402
6402
|
(Protected) Sets the root node and clears its parent reference.
|
|
6403
6403
|
|
|
@@ -6429,7 +6429,7 @@ Time O(1)
|
|
|
6429
6429
|
protected _setValue(key, value): boolean;
|
|
6430
6430
|
```
|
|
6431
6431
|
|
|
6432
|
-
Defined in: [data-structures/binary-tree/binary-tree.ts:
|
|
6432
|
+
Defined in: [data-structures/binary-tree/binary-tree.ts:3673](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3673)
|
|
6433
6433
|
|
|
6434
6434
|
(Protected) Sets a value in the external store (Map mode).
|
|
6435
6435
|
|
|
@@ -6469,7 +6469,7 @@ Time O(1) (average for Map.set).
|
|
|
6469
6469
|
protected _snapshotOptions<TK, TV, TR>(): BSTOptions<TK, TV, TR>;
|
|
6470
6470
|
```
|
|
6471
6471
|
|
|
6472
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
6472
|
+
Defined in: [data-structures/binary-tree/bst.ts:3274](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3274)
|
|
6473
6473
|
|
|
6474
6474
|
(Protected) Snapshots the current BST's configuration options.
|
|
6475
6475
|
|
|
@@ -6509,7 +6509,7 @@ Time O(1)
|
|
|
6509
6509
|
protected _swapProperties(srcNode, destNode): AVLTreeNode<K, V> | undefined;
|
|
6510
6510
|
```
|
|
6511
6511
|
|
|
6512
|
-
Defined in: [data-structures/binary-tree/avl-tree.ts:
|
|
6512
|
+
Defined in: [data-structures/binary-tree/avl-tree.ts:1003](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/avl-tree.ts#L1003)
|
|
6513
6513
|
|
|
6514
6514
|
(Protected) Swaps properties of two nodes, including height.
|
|
6515
6515
|
|
|
@@ -6549,7 +6549,7 @@ Time O(H) (due to `ensureNode`), but O(1) if nodes are passed directly.
|
|
|
6549
6549
|
protected _updateCount(node): void;
|
|
6550
6550
|
```
|
|
6551
6551
|
|
|
6552
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
6552
|
+
Defined in: [data-structures/binary-tree/bst.ts:3309](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3309)
|
|
6553
6553
|
|
|
6554
6554
|
(Protected) Recalculates the subtree count for a single node.
|
|
6555
6555
|
|
|
@@ -6579,7 +6579,7 @@ Time O(1). Only active when enableOrderStatistic is true.
|
|
|
6579
6579
|
protected _updateCountAlongPath(node): void;
|
|
6580
6580
|
```
|
|
6581
6581
|
|
|
6582
|
-
Defined in: [data-structures/binary-tree/bst.ts:
|
|
6582
|
+
Defined in: [data-structures/binary-tree/bst.ts:3320](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3320)
|
|
6583
6583
|
|
|
6584
6584
|
(Protected) Updates subtree counts from a node up to the root.
|
|
6585
6585
|
|
|
@@ -6609,7 +6609,7 @@ Time O(log n). Only active when enableOrderStatistic is true.
|
|
|
6609
6609
|
protected _updateHeight(node): void;
|
|
6610
6610
|
```
|
|
6611
6611
|
|
|
6612
|
-
Defined in: [data-structures/binary-tree/avl-tree.ts:
|
|
6612
|
+
Defined in: [data-structures/binary-tree/avl-tree.ts:1053](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/avl-tree.ts#L1053)
|
|
6613
6613
|
|
|
6614
6614
|
(Protected) Recalculates and updates the height of a node based on its children's heights.
|
|
6615
6615
|
|