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.
Files changed (158) hide show
  1. package/.github/workflows/ci.yml +7 -2
  2. package/.github/workflows/release-package.yml +9 -2
  3. package/.husky/pre-commit +3 -0
  4. package/CHANGELOG.md +1 -1
  5. package/MIGRATION.md +48 -0
  6. package/README.md +20 -2
  7. package/README_CN.md +20 -2
  8. package/SPECIFICATION.md +24 -0
  9. package/SPECIFICATION.zh-CN.md +24 -0
  10. package/dist/cjs/binary-tree.cjs +1897 -19
  11. package/dist/cjs/graph.cjs +174 -0
  12. package/dist/cjs/hash.cjs +33 -0
  13. package/dist/cjs/heap.cjs +71 -0
  14. package/dist/cjs/index.cjs +2383 -3
  15. package/dist/cjs/linked-list.cjs +224 -2
  16. package/dist/cjs/matrix.cjs +24 -0
  17. package/dist/cjs/priority-queue.cjs +71 -0
  18. package/dist/cjs/queue.cjs +221 -1
  19. package/dist/cjs/stack.cjs +59 -0
  20. package/dist/cjs/trie.cjs +62 -0
  21. package/dist/cjs-legacy/binary-tree.cjs +1897 -19
  22. package/dist/cjs-legacy/graph.cjs +174 -0
  23. package/dist/cjs-legacy/hash.cjs +33 -0
  24. package/dist/cjs-legacy/heap.cjs +71 -0
  25. package/dist/cjs-legacy/index.cjs +2383 -3
  26. package/dist/cjs-legacy/linked-list.cjs +224 -2
  27. package/dist/cjs-legacy/matrix.cjs +24 -0
  28. package/dist/cjs-legacy/priority-queue.cjs +71 -0
  29. package/dist/cjs-legacy/queue.cjs +221 -1
  30. package/dist/cjs-legacy/stack.cjs +59 -0
  31. package/dist/cjs-legacy/trie.cjs +62 -0
  32. package/dist/esm/binary-tree.mjs +1897 -19
  33. package/dist/esm/graph.mjs +174 -0
  34. package/dist/esm/hash.mjs +33 -0
  35. package/dist/esm/heap.mjs +71 -0
  36. package/dist/esm/index.mjs +2383 -3
  37. package/dist/esm/linked-list.mjs +224 -2
  38. package/dist/esm/matrix.mjs +24 -0
  39. package/dist/esm/priority-queue.mjs +71 -0
  40. package/dist/esm/queue.mjs +221 -1
  41. package/dist/esm/stack.mjs +59 -0
  42. package/dist/esm/trie.mjs +62 -0
  43. package/dist/esm-legacy/binary-tree.mjs +1897 -19
  44. package/dist/esm-legacy/graph.mjs +174 -0
  45. package/dist/esm-legacy/hash.mjs +33 -0
  46. package/dist/esm-legacy/heap.mjs +71 -0
  47. package/dist/esm-legacy/index.mjs +2383 -3
  48. package/dist/esm-legacy/linked-list.mjs +224 -2
  49. package/dist/esm-legacy/matrix.mjs +24 -0
  50. package/dist/esm-legacy/priority-queue.mjs +71 -0
  51. package/dist/esm-legacy/queue.mjs +221 -1
  52. package/dist/esm-legacy/stack.mjs +59 -0
  53. package/dist/esm-legacy/trie.mjs +62 -0
  54. package/dist/types/data-structures/base/iterable-element-base.d.ts +17 -0
  55. package/dist/types/data-structures/base/linear-base.d.ts +6 -0
  56. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +36 -0
  57. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +42 -0
  58. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +75 -0
  59. package/dist/types/data-structures/binary-tree/bst.d.ts +72 -0
  60. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +57 -0
  61. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +18 -0
  62. package/dist/types/data-structures/binary-tree/tree-map.d.ts +375 -0
  63. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +389 -0
  64. package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +330 -0
  65. package/dist/types/data-structures/binary-tree/tree-set.d.ts +438 -0
  66. package/dist/types/data-structures/graph/directed-graph.d.ts +30 -0
  67. package/dist/types/data-structures/graph/undirected-graph.d.ts +27 -0
  68. package/dist/types/data-structures/hash/hash-map.d.ts +33 -0
  69. package/dist/types/data-structures/heap/heap.d.ts +42 -0
  70. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +75 -2
  71. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +45 -0
  72. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +54 -0
  73. package/dist/types/data-structures/matrix/matrix.d.ts +24 -0
  74. package/dist/types/data-structures/queue/deque.d.ts +90 -1
  75. package/dist/types/data-structures/queue/queue.d.ts +36 -0
  76. package/dist/types/data-structures/stack/stack.d.ts +30 -0
  77. package/dist/types/data-structures/trie/trie.d.ts +36 -0
  78. package/dist/umd/data-structure-typed.js +2383 -3
  79. package/dist/umd/data-structure-typed.min.js +3 -3
  80. package/docs-site-docusaurus/docs/api/classes/AVLTree.md +108 -108
  81. package/docs-site-docusaurus/docs/api/classes/BST.md +101 -101
  82. package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +13 -13
  83. package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +66 -66
  84. package/docs-site-docusaurus/docs/api/classes/Deque.md +235 -51
  85. package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +21 -21
  86. package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +231 -67
  87. package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +9 -9
  88. package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +1 -1
  89. package/docs-site-docusaurus/docs/api/classes/HashMap.md +14 -14
  90. package/docs-site-docusaurus/docs/api/classes/Heap.md +117 -34
  91. package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +83 -13
  92. package/docs-site-docusaurus/docs/api/classes/LinearBase.md +124 -20
  93. package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +140 -32
  94. package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +30 -26
  95. package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +159 -51
  96. package/docs-site-docusaurus/docs/api/classes/MapGraph.md +20 -20
  97. package/docs-site-docusaurus/docs/api/classes/Matrix.md +23 -23
  98. package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +117 -34
  99. package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +117 -34
  100. package/docs-site-docusaurus/docs/api/classes/MinHeap.md +117 -34
  101. package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +117 -34
  102. package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +117 -34
  103. package/docs-site-docusaurus/docs/api/classes/Queue.md +142 -34
  104. package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +117 -117
  105. package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +8 -8
  106. package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +158 -50
  107. package/docs-site-docusaurus/docs/api/classes/SkipList.md +21 -21
  108. package/docs-site-docusaurus/docs/api/classes/Stack.md +108 -26
  109. package/docs-site-docusaurus/docs/api/classes/TreeMap.md +33 -33
  110. package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +75 -39
  111. package/docs-site-docusaurus/docs/api/classes/TreeSet.md +301 -39
  112. package/docs-site-docusaurus/docs/api/classes/Trie.md +110 -28
  113. package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +20 -20
  114. package/jest.integration.config.js +1 -2
  115. package/package.json +51 -50
  116. package/src/common/error.ts +15 -32
  117. package/src/common/index.ts +0 -3
  118. package/src/data-structures/base/iterable-element-base.ts +32 -3
  119. package/src/data-structures/base/linear-base.ts +13 -36
  120. package/src/data-structures/binary-tree/avl-tree.ts +31 -493
  121. package/src/data-structures/binary-tree/binary-indexed-tree.ts +47 -530
  122. package/src/data-structures/binary-tree/binary-tree.ts +326 -1236
  123. package/src/data-structures/binary-tree/bst.ts +158 -1010
  124. package/src/data-structures/binary-tree/red-black-tree.ts +451 -1233
  125. package/src/data-structures/binary-tree/segment-tree.ts +73 -333
  126. package/src/data-structures/binary-tree/tree-map.ts +462 -4749
  127. package/src/data-structures/binary-tree/tree-multi-map.ts +310 -4530
  128. package/src/data-structures/binary-tree/tree-multi-set.ts +300 -3652
  129. package/src/data-structures/binary-tree/tree-set.ts +437 -4443
  130. package/src/data-structures/graph/abstract-graph.ts +98 -167
  131. package/src/data-structures/graph/directed-graph.ts +137 -532
  132. package/src/data-structures/graph/map-graph.ts +0 -3
  133. package/src/data-structures/graph/undirected-graph.ts +132 -484
  134. package/src/data-structures/hash/hash-map.ts +154 -549
  135. package/src/data-structures/heap/heap.ts +200 -753
  136. package/src/data-structures/linked-list/doubly-linked-list.ts +153 -809
  137. package/src/data-structures/linked-list/singly-linked-list.ts +122 -749
  138. package/src/data-structures/linked-list/skip-linked-list.ts +211 -864
  139. package/src/data-structures/matrix/matrix.ts +179 -494
  140. package/src/data-structures/matrix/navigator.ts +0 -1
  141. package/src/data-structures/priority-queue/max-priority-queue.ts +1 -6
  142. package/src/data-structures/priority-queue/min-priority-queue.ts +6 -11
  143. package/src/data-structures/priority-queue/priority-queue.ts +1 -2
  144. package/src/data-structures/queue/deque.ts +241 -807
  145. package/src/data-structures/queue/queue.ts +102 -589
  146. package/src/data-structures/stack/stack.ts +76 -475
  147. package/src/data-structures/trie/trie.ts +98 -592
  148. package/src/types/common.ts +0 -10
  149. package/src/types/data-structures/binary-tree/bst.ts +0 -7
  150. package/src/types/data-structures/binary-tree/red-black-tree.ts +0 -1
  151. package/src/types/data-structures/graph/abstract-graph.ts +0 -2
  152. package/src/types/data-structures/hash/hash-map.ts +0 -3
  153. package/src/types/data-structures/hash/index.ts +0 -1
  154. package/src/types/data-structures/matrix/navigator.ts +0 -2
  155. package/src/types/utils/utils.ts +0 -7
  156. package/src/types/utils/validate-type.ts +0 -7
  157. package/src/utils/number.ts +0 -2
  158. package/src/utils/utils.ts +0 -5
@@ -434,7 +434,7 @@ IBinaryTree.[iterator]
434
434
  add(keyNodeOrEntry): boolean;
435
435
  ```
436
436
 
437
- Defined in: [data-structures/binary-tree/binary-tree.ts:612](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L612)
437
+ 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)
438
438
 
439
439
  Adds a new node to the tree.
440
440
 
@@ -492,7 +492,7 @@ IBinaryTree.add
492
492
  addMany(keysNodesEntriesOrRaws): boolean[];
493
493
  ```
494
494
 
495
- Defined in: [data-structures/binary-tree/binary-tree.ts:793](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L793)
495
+ 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)
496
496
 
497
497
  Adds multiple items to the tree.
498
498
 
@@ -573,7 +573,7 @@ The traversal method.
573
573
  bfs(): (K | undefined)[];
574
574
  ```
575
575
 
576
- Defined in: [data-structures/binary-tree/bst.ts:635](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L635)
576
+ 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)
577
577
 
578
578
  BinaryTree level-order traversal
579
579
 
@@ -611,7 +611,7 @@ bfs<C>(
611
611
  iterationType?): ReturnType<C>[];
612
612
  ```
613
613
 
614
- Defined in: [data-structures/binary-tree/bst.ts:636](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L636)
614
+ 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)
615
615
 
616
616
  BinaryTree level-order traversal
617
617
 
@@ -673,7 +673,7 @@ IBinaryTree.bfs
673
673
  ceiling(keyNodeEntryOrPredicate): K | undefined;
674
674
  ```
675
675
 
676
- Defined in: [data-structures/binary-tree/bst.ts:1849](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1849)
676
+ 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)
677
677
 
678
678
  Returns the first key with a value >= target.
679
679
  Equivalent to Java TreeMap.ceiling.
@@ -720,7 +720,7 @@ ceiling<C>(
720
720
  iterationType?): ReturnType<C>;
721
721
  ```
722
722
 
723
- Defined in: [data-structures/binary-tree/bst.ts:1864](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1864)
723
+ 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)
724
724
 
725
725
  Returns the first node with a key >= target and applies callback.
726
726
  Time Complexity: O(log n) average, O(h) worst case.
@@ -767,7 +767,7 @@ Space Complexity: O(h) for recursion, O(1) for iteration.
767
767
  clear(): void;
768
768
  ```
769
769
 
770
- Defined in: [data-structures/binary-tree/red-black-tree.ts:490](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L490)
770
+ Defined in: [data-structures/binary-tree/red-black-tree.ts:502](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L502)
771
771
 
772
772
  Remove all nodes, clear the key→value store (if in map mode) and internal caches.
773
773
 
@@ -808,7 +808,7 @@ IBinaryTree.clear
808
808
  clone(): this;
809
809
  ```
810
810
 
811
- Defined in: [data-structures/binary-tree/binary-tree.ts:2771](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2771)
811
+ 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)
812
812
 
813
813
  Clones the tree.
814
814
 
@@ -947,7 +947,7 @@ IBinaryTree.createTree
947
947
  delete(keyNodeEntryRawOrPredicate): boolean;
948
948
  ```
949
949
 
950
- Defined in: [data-structures/binary-tree/red-black-tree.ts:1267](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L1267)
950
+ Defined in: [data-structures/binary-tree/red-black-tree.ts:1303](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L1303)
951
951
 
952
952
  Delete a node by key/node/entry and rebalance as needed.
953
953
 
@@ -1004,7 +1004,7 @@ deleteWhere(
1004
1004
  iterationType?): boolean;
1005
1005
  ```
1006
1006
 
1007
- Defined in: [data-structures/binary-tree/bst.ts:2692](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2692)
1007
+ 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)
1008
1008
 
1009
1009
  Deletes nodes that match a key, node, entry, predicate, or range.
1010
1010
 
@@ -1115,7 +1115,7 @@ The traversal method.
1115
1115
  dfs(): (K | undefined)[];
1116
1116
  ```
1117
1117
 
1118
- Defined in: [data-structures/binary-tree/bst.ts:525](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L525)
1118
+ 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)
1119
1119
 
1120
1120
  Depth-first search traversal
1121
1121
 
@@ -1155,7 +1155,7 @@ dfs<C>(
1155
1155
  iterationType?): ReturnType<C>[];
1156
1156
  ```
1157
1157
 
1158
- Defined in: [data-structures/binary-tree/bst.ts:527](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L527)
1158
+ 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)
1159
1159
 
1160
1160
  Depth-first search traversal
1161
1161
 
@@ -1345,7 +1345,7 @@ IBinaryTree.every
1345
1345
  filter(predicate, thisArg?): this;
1346
1346
  ```
1347
1347
 
1348
- Defined in: [data-structures/binary-tree/binary-tree.ts:2827](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2827)
1348
+ 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)
1349
1349
 
1350
1350
  Creates a new tree containing only the entries that satisfy the predicate.
1351
1351
 
@@ -1450,7 +1450,7 @@ IBinaryTree.find
1450
1450
  floor(keyNodeEntryOrPredicate): K | undefined;
1451
1451
  ```
1452
1452
 
1453
- Defined in: [data-structures/binary-tree/bst.ts:2068](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2068)
1453
+ 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)
1454
1454
 
1455
1455
  Returns the first key with a value <= target.
1456
1456
  Equivalent to Java TreeMap.floor.
@@ -1497,7 +1497,7 @@ floor<C>(
1497
1497
  iterationType?): ReturnType<C>;
1498
1498
  ```
1499
1499
 
1500
- Defined in: [data-structures/binary-tree/bst.ts:2083](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2083)
1500
+ 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)
1501
1501
 
1502
1502
  Returns the first node with a key <= target and applies callback.
1503
1503
  Time Complexity: O(log n) average, O(h) worst case.
@@ -1591,7 +1591,7 @@ get(
1591
1591
  iterationType?): V | undefined;
1592
1592
  ```
1593
1593
 
1594
- Defined in: [data-structures/binary-tree/binary-tree.ts:1375](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1375)
1594
+ 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)
1595
1595
 
1596
1596
  Gets the value associated with a key.
1597
1597
 
@@ -1663,7 +1663,7 @@ IBinaryTree.get
1663
1663
  getByRank(k): K | undefined;
1664
1664
  ```
1665
1665
 
1666
- Defined in: [data-structures/binary-tree/bst.ts:1240](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1240)
1666
+ 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)
1667
1667
 
1668
1668
  Returns the element at the k-th position in tree order (0-indexed).
1669
1669
 
@@ -1710,7 +1710,7 @@ getByRank<C>(
1710
1710
  iterationType?): ReturnType<C> | undefined;
1711
1711
  ```
1712
1712
 
1713
- Defined in: [data-structures/binary-tree/bst.ts:1251](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1251)
1713
+ 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)
1714
1714
 
1715
1715
  Returns the element at the k-th position in tree order and applies a callback.
1716
1716
 
@@ -1762,7 +1762,7 @@ Time O(log n), Space O(1) iterative / O(log n) recursive. Requires `enableOrderS
1762
1762
  getDepth(dist, startNode?): number;
1763
1763
  ```
1764
1764
 
1765
- Defined in: [data-structures/binary-tree/binary-tree.ts:1756](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1756)
1765
+ 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)
1766
1766
 
1767
1767
  Gets the depth of a node (distance from `startNode`).
1768
1768
 
@@ -1826,7 +1826,7 @@ IBinaryTree.getDepth
1826
1826
  getHeight(startNode?, iterationType?): number;
1827
1827
  ```
1828
1828
 
1829
- Defined in: [data-structures/binary-tree/binary-tree.ts:1824](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1824)
1829
+ 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)
1830
1830
 
1831
1831
  Gets the maximum height of the tree (longest path from startNode to a leaf).
1832
1832
 
@@ -1909,7 +1909,7 @@ The traversal method.
1909
1909
  getLeftMost(): K | undefined;
1910
1910
  ```
1911
1911
 
1912
- Defined in: [data-structures/binary-tree/binary-tree.ts:1951](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1951)
1912
+ 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)
1913
1913
 
1914
1914
  ##### Returns
1915
1915
 
@@ -1934,7 +1934,7 @@ getLeftMost<C>(
1934
1934
  iterationType?): ReturnType<C>;
1935
1935
  ```
1936
1936
 
1937
- Defined in: [data-structures/binary-tree/binary-tree.ts:1953](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1953)
1937
+ 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)
1938
1938
 
1939
1939
  ##### Type Parameters
1940
1940
 
@@ -1981,7 +1981,7 @@ IBinaryTree.getLeftMost
1981
1981
  getMinHeight(startNode?, iterationType?): number;
1982
1982
  ```
1983
1983
 
1984
- Defined in: [data-structures/binary-tree/binary-tree.ts:1866](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1866)
1984
+ 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)
1985
1985
 
1986
1986
  Gets the minimum height of the tree (shortest path from startNode to a leaf).
1987
1987
 
@@ -2033,7 +2033,7 @@ getNode(
2033
2033
  iterationType?): OptNode<BSTNode<K, V>>;
2034
2034
  ```
2035
2035
 
2036
- Defined in: [data-structures/binary-tree/bst.ts:860](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L860)
2036
+ 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)
2037
2037
 
2038
2038
  Gets the first node matching a predicate.
2039
2039
 
@@ -2106,7 +2106,7 @@ getNodes(
2106
2106
  iterationType?): BinaryTreeNode<K, V>[];
2107
2107
  ```
2108
2108
 
2109
- Defined in: [data-structures/binary-tree/binary-tree.ts:1223](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1223)
2109
+ 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)
2110
2110
 
2111
2111
  Gets all nodes matching a predicate.
2112
2112
 
@@ -2201,7 +2201,7 @@ If true, returns the path from root-to-node.
2201
2201
  getPathToRoot(beginNode): (K | undefined)[];
2202
2202
  ```
2203
2203
 
2204
- Defined in: [data-structures/binary-tree/binary-tree.ts:1913](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1913)
2204
+ 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)
2205
2205
 
2206
2206
  ##### Parameters
2207
2207
 
@@ -2236,7 +2236,7 @@ getPathToRoot<C>(
2236
2236
  isReverse?): ReturnType<C>[];
2237
2237
  ```
2238
2238
 
2239
- Defined in: [data-structures/binary-tree/binary-tree.ts:1917](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1917)
2239
+ 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)
2240
2240
 
2241
2241
  ##### Type Parameters
2242
2242
 
@@ -2284,7 +2284,7 @@ IBinaryTree.getPathToRoot
2284
2284
  getPredecessor(node): BinaryTreeNode<K, V>;
2285
2285
  ```
2286
2286
 
2287
- Defined in: [data-structures/binary-tree/binary-tree.ts:2051](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2051)
2287
+ 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)
2288
2288
 
2289
2289
  Gets the Morris traversal predecessor (rightmost node in the left subtree, or node itself).
2290
2290
 
@@ -2320,7 +2320,7 @@ This is primarily a helper for Morris traversal. Time O(H), where H is the heigh
2320
2320
  getRank(keyNodeEntryOrPredicate): number;
2321
2321
  ```
2322
2322
 
2323
- Defined in: [data-structures/binary-tree/bst.ts:1295](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1295)
2323
+ 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)
2324
2324
 
2325
2325
  Returns the 0-based rank of a key (number of elements that precede it in tree order).
2326
2326
 
@@ -2358,7 +2358,7 @@ Tree order is defined by the comparator. When the key is not found, returns the
2358
2358
  getRank(keyNodeEntryOrPredicate, iterationType): number;
2359
2359
  ```
2360
2360
 
2361
- Defined in: [data-structures/binary-tree/bst.ts:1313](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1313)
2361
+ 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)
2362
2362
 
2363
2363
  Returns the 0-based rank (number of preceding elements in tree order) with explicit iteration type.
2364
2364
 
@@ -2427,7 +2427,7 @@ The traversal method.
2427
2427
  getRightMost(): K | undefined;
2428
2428
  ```
2429
2429
 
2430
- Defined in: [data-structures/binary-tree/binary-tree.ts:1998](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1998)
2430
+ 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)
2431
2431
 
2432
2432
  ##### Returns
2433
2433
 
@@ -2452,7 +2452,7 @@ getRightMost<C>(
2452
2452
  iterationType?): ReturnType<C>;
2453
2453
  ```
2454
2454
 
2455
- Defined in: [data-structures/binary-tree/binary-tree.ts:2000](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2000)
2455
+ 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)
2456
2456
 
2457
2457
  ##### Type Parameters
2458
2458
 
@@ -2499,7 +2499,7 @@ IBinaryTree.getRightMost
2499
2499
  getSuccessor(x?): BinaryTreeNode<K, V> | null | undefined;
2500
2500
  ```
2501
2501
 
2502
- Defined in: [data-structures/binary-tree/binary-tree.ts:2072](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2072)
2502
+ 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)
2503
2503
 
2504
2504
  Gets the in-order successor of a node in a BST.
2505
2505
 
@@ -2536,7 +2536,7 @@ has(
2536
2536
  iterationType?): boolean;
2537
2537
  ```
2538
2538
 
2539
- Defined in: [data-structures/binary-tree/binary-tree.ts:1464](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1464)
2539
+ 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)
2540
2540
 
2541
2541
  Checks if a node matching the predicate exists in the tree.
2542
2542
 
@@ -2671,7 +2671,7 @@ IBinaryTree.hasValue
2671
2671
  higher(keyNodeEntryOrPredicate): K | undefined;
2672
2672
  ```
2673
2673
 
2674
- Defined in: [data-structures/binary-tree/bst.ts:1958](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1958)
2674
+ 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)
2675
2675
 
2676
2676
  Returns the first key with a value > target.
2677
2677
  Equivalent to Java TreeMap.higher.
@@ -2717,7 +2717,7 @@ higher<C>(
2717
2717
  iterationType?): ReturnType<C>;
2718
2718
  ```
2719
2719
 
2720
- Defined in: [data-structures/binary-tree/bst.ts:1973](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1973)
2720
+ 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)
2721
2721
 
2722
2722
  Returns the first node with a key > target and applies callback.
2723
2723
  Time Complexity: O(log n) average, O(h) worst case.
@@ -2764,7 +2764,7 @@ Space Complexity: O(h) for recursion, O(1) for iteration.
2764
2764
  isAVLBalanced(iterationType?): boolean;
2765
2765
  ```
2766
2766
 
2767
- Defined in: [data-structures/binary-tree/bst.ts:2505](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2505)
2767
+ 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)
2768
2768
 
2769
2769
  Checks if the tree meets the AVL balance condition (height difference <= 1).
2770
2770
 
@@ -2808,7 +2808,7 @@ Time O(N), as it must visit every node to compute height. Space O(log N) for rec
2808
2808
  isBST(startNode?, iterationType?): boolean;
2809
2809
  ```
2810
2810
 
2811
- Defined in: [data-structures/binary-tree/binary-tree.ts:1661](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1661)
2811
+ 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)
2812
2812
 
2813
2813
  Checks if the tree is a valid Binary Search Tree (BST).
2814
2814
 
@@ -2868,7 +2868,7 @@ IBinaryTree.isBST
2868
2868
  isEmpty(): boolean;
2869
2869
  ```
2870
2870
 
2871
- Defined in: [data-structures/binary-tree/binary-tree.ts:1594](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1594)
2871
+ 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)
2872
2872
 
2873
2873
  Checks if the tree is empty.
2874
2874
 
@@ -3061,7 +3061,7 @@ Time O(1), Space O(1)
3061
3061
  isPerfectlyBalanced(startNode?): boolean;
3062
3062
  ```
3063
3063
 
3064
- Defined in: [data-structures/binary-tree/binary-tree.ts:1605](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1605)
3064
+ 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)
3065
3065
 
3066
3066
  Checks if the tree is perfectly balanced.
3067
3067
 
@@ -3349,7 +3349,7 @@ The traversal method.
3349
3349
  leaves(): (K | undefined)[];
3350
3350
  ```
3351
3351
 
3352
- Defined in: [data-structures/binary-tree/binary-tree.ts:2378](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2378)
3352
+ 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)
3353
3353
 
3354
3354
  Get leaf nodes
3355
3355
 
@@ -3387,7 +3387,7 @@ leaves<C>(
3387
3387
  iterationType?): ReturnType<C>[];
3388
3388
  ```
3389
3389
 
3390
- Defined in: [data-structures/binary-tree/binary-tree.ts:2380](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2380)
3390
+ 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)
3391
3391
 
3392
3392
  Get leaf nodes
3393
3393
 
@@ -3475,7 +3475,7 @@ The traversal method.
3475
3475
  lesserOrGreaterTraverse(): (K | undefined)[];
3476
3476
  ```
3477
3477
 
3478
- Defined in: [data-structures/binary-tree/bst.ts:2323](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2323)
3478
+ 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)
3479
3479
 
3480
3480
  ##### Returns
3481
3481
 
@@ -3495,7 +3495,7 @@ lesserOrGreaterTraverse<C>(
3495
3495
  iterationType?): ReturnType<C>[];
3496
3496
  ```
3497
3497
 
3498
- Defined in: [data-structures/binary-tree/bst.ts:2325](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2325)
3498
+ 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)
3499
3499
 
3500
3500
  ##### Type Parameters
3501
3501
 
@@ -3564,7 +3564,7 @@ The traversal method.
3564
3564
  listLevels(): (K | undefined)[][];
3565
3565
  ```
3566
3566
 
3567
- Defined in: [data-structures/binary-tree/bst.ts:744](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L744)
3567
+ 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)
3568
3568
 
3569
3569
  Level-order grouping
3570
3570
 
@@ -3605,7 +3605,7 @@ listLevels<C>(
3605
3605
  iterationType?): ReturnType<C>[][];
3606
3606
  ```
3607
3607
 
3608
- Defined in: [data-structures/binary-tree/bst.ts:746](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L746)
3608
+ 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)
3609
3609
 
3610
3610
  Level-order grouping
3611
3611
 
@@ -3670,7 +3670,7 @@ IBinaryTree.listLevels
3670
3670
  lower(keyNodeEntryOrPredicate): K | undefined;
3671
3671
  ```
3672
3672
 
3673
- Defined in: [data-structures/binary-tree/bst.ts:2220](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2220)
3673
+ 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)
3674
3674
 
3675
3675
  Returns the first key with a value < target.
3676
3676
  Equivalent to Java TreeMap.lower.
@@ -3716,7 +3716,7 @@ lower<C>(
3716
3716
  iterationType?): ReturnType<C>;
3717
3717
  ```
3718
3718
 
3719
- Defined in: [data-structures/binary-tree/bst.ts:2235](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2235)
3719
+ 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)
3720
3720
 
3721
3721
  Returns the first node with a key < target and applies callback.
3722
3722
  Time Complexity: O(log n) average, O(h) worst case.
@@ -3766,7 +3766,7 @@ map<MK, MV, MR>(
3766
3766
  thisArg?): RedBlackTree<MK, MV, MR>;
3767
3767
  ```
3768
3768
 
3769
- Defined in: [data-structures/binary-tree/red-black-tree.ts:1652](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L1652)
3769
+ Defined in: [data-structures/binary-tree/red-black-tree.ts:1709](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L1709)
3770
3770
 
3771
3771
  Transform to new tree
3772
3772
 
@@ -3831,7 +3831,7 @@ IBinaryTree.map
3831
3831
  merge(anotherTree): void;
3832
3832
  ```
3833
3833
 
3834
- Defined in: [data-structures/binary-tree/binary-tree.ts:922](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L922)
3834
+ 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)
3835
3835
 
3836
3836
  Merges another tree into this one by seting all its nodes.
3837
3837
 
@@ -3905,7 +3905,7 @@ The node to start from.
3905
3905
  morris(): (K | undefined)[];
3906
3906
  ```
3907
3907
 
3908
- Defined in: [data-structures/binary-tree/binary-tree.ts:2604](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2604)
3908
+ 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)
3909
3909
 
3910
3910
  Morris traversal (O(1) space)
3911
3911
 
@@ -3943,7 +3943,7 @@ morris<C>(
3943
3943
  startNode?): ReturnType<C>[];
3944
3944
  ```
3945
3945
 
3946
- Defined in: [data-structures/binary-tree/binary-tree.ts:2606](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2606)
3946
+ 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)
3947
3947
 
3948
3948
  Morris traversal (O(1) space)
3949
3949
 
@@ -4003,7 +4003,7 @@ IBinaryTree.morris
4003
4003
  perfectlyBalance(_iterationType?): boolean;
4004
4004
  ```
4005
4005
 
4006
- Defined in: [data-structures/binary-tree/red-black-tree.ts:1483](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L1483)
4006
+ Defined in: [data-structures/binary-tree/red-black-tree.ts:1528](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L1528)
4007
4007
 
4008
4008
  Red-Black trees are self-balancing — `perfectlyBalance` rebuilds via
4009
4009
  sorted bulk insert, which naturally produces a balanced RBT.
@@ -4045,7 +4045,7 @@ Time O(N), Space O(N)
4045
4045
  print(options?, startNode?): void;
4046
4046
  ```
4047
4047
 
4048
- Defined in: [data-structures/binary-tree/binary-tree.ts:2981](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2981)
4048
+ 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)
4049
4049
 
4050
4050
  Prints a visual representation of the tree to the console.
4051
4051
 
@@ -4098,7 +4098,7 @@ Time O(N) (via `toVisual`). Space O(N*H) or O(N^2) (via `toVisual`).
4098
4098
  rangeByRank(start, end): (K | undefined)[];
4099
4099
  ```
4100
4100
 
4101
- Defined in: [data-structures/binary-tree/bst.ts:1375](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1375)
4101
+ 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)
4102
4102
 
4103
4103
  Returns elements by position range in tree order (0-indexed, inclusive on both ends).
4104
4104
 
@@ -4140,7 +4140,7 @@ rangeByRank<C>(
4140
4140
  iterationType?): ReturnType<C>[];
4141
4141
  ```
4142
4142
 
4143
- Defined in: [data-structures/binary-tree/bst.ts:1387](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1387)
4143
+ 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)
4144
4144
 
4145
4145
  Returns elements by position range in tree order with callback and optional iteration type.
4146
4146
 
@@ -4226,7 +4226,7 @@ The traversal method.
4226
4226
  rangeSearch(range): (K | undefined)[];
4227
4227
  ```
4228
4228
 
4229
- Defined in: [data-structures/binary-tree/bst.ts:1194](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1194)
4229
+ 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)
4230
4230
 
4231
4231
  Find all keys in a range
4232
4232
 
@@ -4264,7 +4264,7 @@ rangeSearch<C>(
4264
4264
  iterationType?): ReturnType<C>[];
4265
4265
  ```
4266
4266
 
4267
- Defined in: [data-structures/binary-tree/bst.ts:1196](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1196)
4267
+ 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)
4268
4268
 
4269
4269
  Find all keys in a range
4270
4270
 
@@ -4407,7 +4407,7 @@ Whether to use 'RECURSIVE' or 'ITERATIVE' search.
4407
4407
  search(keyNodeEntryOrPredicate, onlyOne?): (K | undefined)[];
4408
4408
  ```
4409
4409
 
4410
- Defined in: [data-structures/binary-tree/bst.ts:996](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L996)
4410
+ 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)
4411
4411
 
4412
4412
  Search nodes by predicate
4413
4413
 
@@ -4463,7 +4463,7 @@ search<C>(
4463
4463
  iterationType?): ReturnType<C>[];
4464
4464
  ```
4465
4465
 
4466
- Defined in: [data-structures/binary-tree/bst.ts:1008](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1008)
4466
+ 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)
4467
4467
 
4468
4468
  Search nodes by predicate
4469
4469
 
@@ -4537,7 +4537,7 @@ IBinaryTree.search
4537
4537
  set(keyNodeOrEntry, value?): boolean;
4538
4538
  ```
4539
4539
 
4540
- Defined in: [data-structures/binary-tree/red-black-tree.ts:1050](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L1050)
4540
+ Defined in: [data-structures/binary-tree/red-black-tree.ts:1074](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L1074)
4541
4541
 
4542
4542
  Insert or update a key/value (map mode) or key-only (set mode).
4543
4543
 
@@ -4612,7 +4612,7 @@ setMany(
4612
4612
  iterationType?): boolean[];
4613
4613
  ```
4614
4614
 
4615
- Defined in: [data-structures/binary-tree/bst.ts:1706](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1706)
4615
+ 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)
4616
4616
 
4617
4617
  Adds multiple items to the tree.
4618
4618
 
@@ -4681,7 +4681,7 @@ setWithHint(
4681
4681
  hint?): boolean;
4682
4682
  ```
4683
4683
 
4684
- Defined in: [data-structures/binary-tree/red-black-tree.ts:872](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L872)
4684
+ Defined in: [data-structures/binary-tree/red-black-tree.ts:884](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L884)
4685
4685
 
4686
4686
  Boolean wrapper for setWithHintNode.
4687
4687
 
@@ -4718,7 +4718,7 @@ setWithHintNode(
4718
4718
  hint?): RedBlackTreeNode<K, V> | undefined;
4719
4719
  ```
4720
4720
 
4721
- Defined in: [data-structures/binary-tree/red-black-tree.ts:772](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L772)
4721
+ Defined in: [data-structures/binary-tree/red-black-tree.ts:784](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L784)
4722
4722
 
4723
4723
  Insert/update using a hint node to speed up nearby insertions.
4724
4724
 
@@ -4831,7 +4831,7 @@ Time O(n), Space O(n)
4831
4831
  toVisual(startNode?, options?): string;
4832
4832
  ```
4833
4833
 
4834
- Defined in: [data-structures/binary-tree/binary-tree.ts:2907](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2907)
4834
+ 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)
4835
4835
 
4836
4836
  Generates a string representation of the tree for visualization.
4837
4837
 
@@ -4929,7 +4929,7 @@ Time O(1) Space O(1)
4929
4929
  protected readonly _DEFAULT_NODE_CALLBACK: NodeCallback<BinaryTreeNode<K, V> | null | undefined, K | undefined>;
4930
4930
  ```
4931
4931
 
4932
- Defined in: [data-structures/binary-tree/binary-tree.ts:3177](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3177)
4932
+ 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)
4933
4933
 
4934
4934
  (Protected) Default callback function, returns the node's key.
4935
4935
 
@@ -4993,7 +4993,7 @@ protected _attachNewNode(
4993
4993
  node): void;
4994
4994
  ```
4995
4995
 
4996
- Defined in: [data-structures/binary-tree/red-black-tree.ts:571](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L571)
4996
+ Defined in: [data-structures/binary-tree/red-black-tree.ts:583](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L583)
4997
4997
 
4998
4998
  (Internal) Attach a new node directly under a known parent/side (no search).
4999
4999
 
@@ -5038,7 +5038,7 @@ protected _bound(
5038
5038
  iterationType): BSTNode<K, V> | undefined;
5039
5039
  ```
5040
5040
 
5041
- Defined in: [data-structures/binary-tree/bst.ts:2993](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2993)
5041
+ 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)
5042
5042
 
5043
5043
  (Protected) Core bound search implementation supporting all parameter types.
5044
5044
  Unified logic for both lowerBound and upperBound.
@@ -5090,7 +5090,7 @@ protected _boundByKey(
5090
5090
  iterationType): BSTNode<K, V> | undefined;
5091
5091
  ```
5092
5092
 
5093
- Defined in: [data-structures/binary-tree/bst.ts:3050](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3050)
5093
+ 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)
5094
5094
 
5095
5095
  (Protected) Binary search for bound by key with pruning optimization.
5096
5096
  Performs standard BST binary search, choosing left or right subtree based on comparator result.
@@ -5135,7 +5135,7 @@ The first node matching the bound condition, or undefined if none exists.
5135
5135
  protected _boundByPredicate(predicate, iterationType): BSTNode<K, V> | undefined;
5136
5136
  ```
5137
5137
 
5138
- Defined in: [data-structures/binary-tree/bst.ts:3105](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3105)
5138
+ 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)
5139
5139
 
5140
5140
  (Protected) In-order traversal search by predicate.
5141
5141
  Falls back to linear in-order traversal when predicate-based search is required.
@@ -5175,7 +5175,7 @@ The first node satisfying predicate, or undefined if none found.
5175
5175
  protected _clearNodes(): void;
5176
5176
  ```
5177
5177
 
5178
- Defined in: [data-structures/binary-tree/binary-tree.ts:3611](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3611)
5178
+ 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)
5179
5179
 
5180
5180
  (Protected) Clears all nodes from the tree.
5181
5181
 
@@ -5199,7 +5199,7 @@ Time O(1)
5199
5199
  protected _clearValues(): void;
5200
5200
  ```
5201
5201
 
5202
- Defined in: [data-structures/binary-tree/binary-tree.ts:3620](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3620)
5202
+ 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)
5203
5203
 
5204
5204
  (Protected) Clears all values from the external store.
5205
5205
 
@@ -5223,7 +5223,7 @@ Time O(N)
5223
5223
  protected _clone(cloned): void;
5224
5224
  ```
5225
5225
 
5226
- Defined in: [data-structures/binary-tree/binary-tree.ts:3270](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3270)
5226
+ 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)
5227
5227
 
5228
5228
  (Protected) Helper for cloning. Performs a BFS and sets all nodes to the new tree.
5229
5229
 
@@ -5255,7 +5255,7 @@ Time O(N * M) (O(N) BFS + O(M) `set` for each node).
5255
5255
  protected _compare(a, b): number;
5256
5256
  ```
5257
5257
 
5258
- Defined in: [data-structures/binary-tree/bst.ts:3369](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3369)
5258
+ 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)
5259
5259
 
5260
5260
  (Protected) Compares two keys using the tree's comparator and reverse setting.
5261
5261
 
@@ -5295,7 +5295,7 @@ Time O(1) Space O(1)
5295
5295
  protected _createDefaultComparator(): Comparator<K>;
5296
5296
  ```
5297
5297
 
5298
- Defined in: [data-structures/binary-tree/bst.ts:2720](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2720)
5298
+ 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)
5299
5299
 
5300
5300
  (Protected) Creates the default comparator function for keys that don't have a custom comparator.
5301
5301
 
@@ -5321,7 +5321,7 @@ Time O(1) Space O(1)
5321
5321
  protected _createInstance<TK, TV, TR>(options?): this;
5322
5322
  ```
5323
5323
 
5324
- Defined in: [data-structures/binary-tree/red-black-tree.ts:1670](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L1670)
5324
+ Defined in: [data-structures/binary-tree/red-black-tree.ts:1727](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L1727)
5325
5325
 
5326
5326
  (Internal) Create an empty instance of the same concrete tree type.
5327
5327
 
@@ -5365,7 +5365,7 @@ Time O(1) average, Space O(1)
5365
5365
  protected _createLike<TK, TV, TR>(iter?, options?): RedBlackTree<TK, TV, TR>;
5366
5366
  ```
5367
5367
 
5368
- Defined in: [data-structures/binary-tree/red-black-tree.ts:1682](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L1682)
5368
+ Defined in: [data-structures/binary-tree/red-black-tree.ts:1739](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L1739)
5369
5369
 
5370
5370
  (Internal) Create a like-kind tree (same concrete class) populated from an iterable.
5371
5371
 
@@ -5419,7 +5419,7 @@ Time O(m log m) average (m = iterable length), Space O(m)
5419
5419
  protected _deleteByKey(key): boolean;
5420
5420
  ```
5421
5421
 
5422
- Defined in: [data-structures/binary-tree/bst.ts:3380](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3380)
5422
+ 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)
5423
5423
 
5424
5424
  (Private) Deletes a node by its key.
5425
5425
 
@@ -5453,7 +5453,7 @@ Standard BST deletion algorithm. Time O(log N), O(N) worst-case. Space O(1).
5453
5453
  protected _deleteFixup(node): void;
5454
5454
  ```
5455
5455
 
5456
- Defined in: [data-structures/binary-tree/red-black-tree.ts:1867](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L1867)
5456
+ Defined in: [data-structures/binary-tree/red-black-tree.ts:1924](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L1924)
5457
5457
 
5458
5458
  (Protected) Restore red-black properties after deletion (recolor/rotate).
5459
5459
 
@@ -5483,7 +5483,7 @@ Time O(log n) average, Space O(1)
5483
5483
  protected _deleteInternal(keyNodeEntryRawOrPredicate): BinaryTreeDeleteResult<BinaryTreeNode<K, V>>[];
5484
5484
  ```
5485
5485
 
5486
- Defined in: [data-structures/binary-tree/binary-tree.ts:934](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L934)
5486
+ 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)
5487
5487
 
5488
5488
  **`Internal`**
5489
5489
 
@@ -5531,7 +5531,7 @@ protected _dfs<C>(
5531
5531
  shouldProcessRoot?): ReturnType<C>[];
5532
5532
  ```
5533
5533
 
5534
- Defined in: [data-structures/binary-tree/binary-tree.ts:2988](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2988)
5534
+ 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)
5535
5535
 
5536
5536
  #### Type Parameters
5537
5537
 
@@ -5624,7 +5624,7 @@ Array of callback results.
5624
5624
  protected _displayAux(node, options): NodeDisplayLayout;
5625
5625
  ```
5626
5626
 
5627
- Defined in: [data-structures/binary-tree/binary-tree.ts:3294](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3294)
5627
+ 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)
5628
5628
 
5629
5629
  (Protected) Recursive helper for `toVisual`.
5630
5630
 
@@ -5664,7 +5664,7 @@ Time O(N), Space O(N*H) or O(N^2)
5664
5664
  protected _ensurePredicate(keyNodeEntryOrPredicate): NodePredicate<BinaryTreeNode<K, V>>;
5665
5665
  ```
5666
5666
 
5667
- Defined in: [data-structures/binary-tree/binary-tree.ts:3517](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3517)
5667
+ 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)
5668
5668
 
5669
5669
  (Protected) Converts a key, node, entry, or predicate into a standardized predicate function.
5670
5670
 
@@ -5703,7 +5703,7 @@ Time O(1)
5703
5703
  protected _extractKey(keyNodeOrEntry): K | null | undefined;
5704
5704
  ```
5705
5705
 
5706
- Defined in: [data-structures/binary-tree/binary-tree.ts:3577](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3577)
5706
+ 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)
5707
5707
 
5708
5708
  (Protected) Extracts the key from a key, node, or entry.
5709
5709
 
@@ -5741,7 +5741,7 @@ Time O(1)
5741
5741
  protected _findNodeByKey(key): RedBlackTreeNode<K, V> | undefined;
5742
5742
  ```
5743
5743
 
5744
- Defined in: [data-structures/binary-tree/red-black-tree.ts:505](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L505)
5744
+ Defined in: [data-structures/binary-tree/red-black-tree.ts:517](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L517)
5745
5745
 
5746
5746
  (Internal) Find a node by key using a tight BST walk (no allocations).
5747
5747
 
@@ -5769,7 +5769,7 @@ Time O(log n) average, Space O(1)
5769
5769
  protected _floorByKey(key, iterationType): BSTNode<K, V> | undefined;
5770
5770
  ```
5771
5771
 
5772
- Defined in: [data-structures/binary-tree/bst.ts:2758](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2758)
5772
+ 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)
5773
5773
 
5774
5774
  (Protected) Binary search for floor by key with pruning optimization.
5775
5775
  Performs standard BST binary search, choosing left or right subtree based on comparator result.
@@ -5811,7 +5811,7 @@ Time O(h) where h is tree height.
5811
5811
  protected _floorByPredicate(predicate, iterationType): BSTNode<K, V> | undefined;
5812
5812
  ```
5813
5813
 
5814
- Defined in: [data-structures/binary-tree/bst.ts:2811](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2811)
5814
+ 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)
5815
5815
 
5816
5816
  (Protected) In-order traversal search for floor by predicate.
5817
5817
  Falls back to linear in-order traversal when predicate-based search is required.
@@ -5854,7 +5854,7 @@ Space Complexity: O(h) for recursion, O(h) for iterative stack.
5854
5854
  protected _getByRankIterative(node, k): BSTNode<K, V> | undefined;
5855
5855
  ```
5856
5856
 
5857
- Defined in: [data-structures/binary-tree/bst.ts:3261](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3261)
5857
+ 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)
5858
5858
 
5859
5859
  (Protected) Finds the node at position k in tree order (iterative).
5860
5860
 
@@ -5888,7 +5888,7 @@ Time O(log n), Space O(1)
5888
5888
  protected _getByRankRecursive(node, k): BSTNode<K, V> | undefined;
5889
5889
  ```
5890
5890
 
5891
- Defined in: [data-structures/binary-tree/bst.ts:3282](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3282)
5891
+ 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)
5892
5892
 
5893
5893
  (Protected) Finds the node at position k in tree order (recursive).
5894
5894
 
@@ -5922,7 +5922,7 @@ Time O(log n), Space O(log n) call stack
5922
5922
  protected _getIterator(node?): IterableIterator<[K, V | undefined]>;
5923
5923
  ```
5924
5924
 
5925
- Defined in: [data-structures/binary-tree/binary-tree.ts:3133](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3133)
5925
+ 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)
5926
5926
 
5927
5927
  (Protected) Gets the iterator for the tree (default in-order).
5928
5928
 
@@ -5956,7 +5956,7 @@ Time O(N) for full iteration. O(H) to get the first element. Space O(H) for the
5956
5956
  protected _getRankIterative(node, key): number;
5957
5957
  ```
5958
5958
 
5959
- Defined in: [data-structures/binary-tree/bst.ts:3294](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3294)
5959
+ 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)
5960
5960
 
5961
5961
  (Protected) Computes the rank of a key iteratively.
5962
5962
 
@@ -5990,7 +5990,7 @@ Time O(log n), Space O(1)
5990
5990
  protected _getRankRecursive(node, key): number;
5991
5991
  ```
5992
5992
 
5993
- 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)
5993
+ 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)
5994
5994
 
5995
5995
  (Protected) Computes the rank of a key recursively.
5996
5996
 
@@ -6024,7 +6024,7 @@ Time O(log n), Space O(log n) call stack
6024
6024
  protected _insert(node): CRUD;
6025
6025
  ```
6026
6026
 
6027
- Defined in: [data-structures/binary-tree/red-black-tree.ts:1729](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L1729)
6027
+ Defined in: [data-structures/binary-tree/red-black-tree.ts:1786](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L1786)
6028
6028
 
6029
6029
  (Protected) Standard BST insert followed by red-black fix-up.
6030
6030
 
@@ -6054,7 +6054,7 @@ Time O(log n) average, Space O(1)
6054
6054
  protected _insertFixup(z): void;
6055
6055
  ```
6056
6056
 
6057
- Defined in: [data-structures/binary-tree/red-black-tree.ts:1798](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L1798)
6057
+ Defined in: [data-structures/binary-tree/red-black-tree.ts:1855](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L1855)
6058
6058
 
6059
6059
  (Protected) Restore red-black properties after insertion (recolor/rotate).
6060
6060
 
@@ -6084,7 +6084,7 @@ Time O(log n) average, Space O(1)
6084
6084
  protected _isDisplayLeaf(node, options): boolean;
6085
6085
  ```
6086
6086
 
6087
- Defined in: [data-structures/binary-tree/binary-tree.ts:3389](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3389)
6087
+ 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)
6088
6088
 
6089
6089
  Check if a node is a display leaf (empty, null, undefined, NIL, or real leaf).
6090
6090
 
@@ -6114,7 +6114,7 @@ Check if a node is a display leaf (empty, null, undefined, NIL, or real leaf).
6114
6114
  protected _isPredicate(p): p is NodePredicate<BinaryTreeNode<K, V>>;
6115
6115
  ```
6116
6116
 
6117
- Defined in: [data-structures/binary-tree/binary-tree.ts:3566](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3566)
6117
+ 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)
6118
6118
 
6119
6119
  (Protected) Checks if an item is a predicate function.
6120
6120
 
@@ -6148,7 +6148,7 @@ Time O(1)
6148
6148
  protected _keyValueNodeOrEntryToNodeAndValue(keyNodeOrEntry, value?): [OptNode<BSTNode<K, V>>, V | undefined];
6149
6149
  ```
6150
6150
 
6151
- Defined in: [data-structures/binary-tree/bst.ts:3218](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3218)
6151
+ 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)
6152
6152
 
6153
6153
  (Protected) Converts a key, node, or entry into a standardized [node, value] tuple.
6154
6154
 
@@ -6192,7 +6192,7 @@ Time O(1)
6192
6192
  protected _leftRotate(x): void;
6193
6193
  ```
6194
6194
 
6195
- Defined in: [data-structures/binary-tree/red-black-tree.ts:1946](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L1946)
6195
+ Defined in: [data-structures/binary-tree/red-black-tree.ts:2003](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L2003)
6196
6196
 
6197
6197
  (Protected) Perform a left rotation around x.
6198
6198
 
@@ -6222,7 +6222,7 @@ Time O(1), Space O(1)
6222
6222
  protected _lowerByKey(key, iterationType): BSTNode<K, V> | undefined;
6223
6223
  ```
6224
6224
 
6225
- Defined in: [data-structures/binary-tree/bst.ts:2876](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2876)
6225
+ 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)
6226
6226
 
6227
6227
  (Protected) Binary search for lower by key with pruning optimization.
6228
6228
  Performs standard BST binary search, choosing left or right subtree based on comparator result.
@@ -6264,7 +6264,7 @@ Time O(h) where h is tree height.
6264
6264
  protected _lowerByPredicate(predicate, iterationType): BSTNode<K, V> | undefined;
6265
6265
  ```
6266
6266
 
6267
- Defined in: [data-structures/binary-tree/bst.ts:2929](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2929)
6267
+ 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)
6268
6268
 
6269
6269
  (Protected) In-order traversal search for lower by predicate.
6270
6270
  Falls back to linear in-order traversal when predicate-based search is required.
@@ -6307,7 +6307,7 @@ Space Complexity: O(h) for recursion, O(h) for iterative stack.
6307
6307
  protected _next(node): BSTNode<K, V> | undefined;
6308
6308
  ```
6309
6309
 
6310
- Defined in: [data-structures/binary-tree/bst.ts:3337](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3337)
6310
+ 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)
6311
6311
 
6312
6312
  (Protected) Finds the in-order successor of a node.
6313
6313
 
@@ -6337,7 +6337,7 @@ Time O(log n), Space O(1)
6337
6337
  protected _predecessorOf(node): RedBlackTreeNode<K, V> | undefined;
6338
6338
  ```
6339
6339
 
6340
- Defined in: [data-structures/binary-tree/red-black-tree.ts:523](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L523)
6340
+ Defined in: [data-structures/binary-tree/red-black-tree.ts:535](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L535)
6341
6341
 
6342
6342
  (Internal) In-order predecessor of a node in a BST.
6343
6343
 
@@ -6363,7 +6363,7 @@ Time O(log n) average, Space O(1)
6363
6363
  protected _replaceNode(oldNode, newNode): RedBlackTreeNode<K, V>;
6364
6364
  ```
6365
6365
 
6366
- Defined in: [data-structures/binary-tree/red-black-tree.ts:1714](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L1714)
6366
+ Defined in: [data-structures/binary-tree/red-black-tree.ts:1771](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L1771)
6367
6367
 
6368
6368
  (Internal) Replace a node in place while preserving its color.
6369
6369
 
@@ -6400,7 +6400,7 @@ protected _resolveDisplayLeaf(
6400
6400
  emptyDisplayLayout): NodeDisplayLayout;
6401
6401
  ```
6402
6402
 
6403
- Defined in: [data-structures/binary-tree/binary-tree.ts:3419](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3419)
6403
+ 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)
6404
6404
 
6405
6405
  Resolve a display leaf node to its layout.
6406
6406
 
@@ -6434,7 +6434,7 @@ Resolve a display leaf node to its layout.
6434
6434
  protected _rightRotate(y): void;
6435
6435
  ```
6436
6436
 
6437
- Defined in: [data-structures/binary-tree/red-black-tree.ts:1982](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L1982)
6437
+ Defined in: [data-structures/binary-tree/red-black-tree.ts:2039](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L2039)
6438
6438
 
6439
6439
  (Protected) Perform a right rotation around y.
6440
6440
 
@@ -6464,7 +6464,7 @@ Time O(1), Space O(1)
6464
6464
  protected _setKV(key, nextValue?): boolean;
6465
6465
  ```
6466
6466
 
6467
- Defined in: [data-structures/binary-tree/red-black-tree.ts:748](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L748)
6467
+ Defined in: [data-structures/binary-tree/red-black-tree.ts:760](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L760)
6468
6468
 
6469
6469
  (Internal) Boolean wrapper around `_setKVNode`.
6470
6470
 
@@ -6505,7 +6505,7 @@ protected _setKVNode(key, nextValue?):
6505
6505
  | undefined;
6506
6506
  ```
6507
6507
 
6508
- Defined in: [data-structures/binary-tree/red-black-tree.ts:621](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L621)
6508
+ Defined in: [data-structures/binary-tree/red-black-tree.ts:633](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L633)
6509
6509
 
6510
6510
  (Internal) Core set implementation returning the affected node.
6511
6511
 
@@ -6549,7 +6549,7 @@ Time O(log n) average, Space O(1)
6549
6549
  protected _setMaxCache(node): void;
6550
6550
  ```
6551
6551
 
6552
- Defined in: [data-structures/binary-tree/red-black-tree.ts:602](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L602)
6552
+ Defined in: [data-structures/binary-tree/red-black-tree.ts:614](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L614)
6553
6553
 
6554
6554
  (Internal) Update max cache pointers (header._right is the canonical max pointer).
6555
6555
 
@@ -6575,7 +6575,7 @@ Time O(1), Space O(1)
6575
6575
  protected _setMinCache(node): void;
6576
6576
  ```
6577
6577
 
6578
- Defined in: [data-structures/binary-tree/red-black-tree.ts:593](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L593)
6578
+ Defined in: [data-structures/binary-tree/red-black-tree.ts:605](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L605)
6579
6579
 
6580
6580
  (Internal) Update min cache pointers (header._left is the canonical min pointer).
6581
6581
 
@@ -6601,7 +6601,7 @@ Time O(1), Space O(1)
6601
6601
  protected _setRoot(v): void;
6602
6602
  ```
6603
6603
 
6604
- Defined in: [data-structures/binary-tree/red-black-tree.ts:1699](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L1699)
6604
+ Defined in: [data-structures/binary-tree/red-black-tree.ts:1756](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L1756)
6605
6605
 
6606
6606
  (Internal) Set the root pointer and keep header.parent in sync.
6607
6607
 
@@ -6631,7 +6631,7 @@ Time O(1), Space O(1)
6631
6631
  protected _setValue(key, value): boolean;
6632
6632
  ```
6633
6633
 
6634
- Defined in: [data-structures/binary-tree/binary-tree.ts:3598](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3598)
6634
+ 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)
6635
6635
 
6636
6636
  (Protected) Sets a value in the external store (Map mode).
6637
6637
 
@@ -6671,7 +6671,7 @@ Time O(1) (average for Map.set).
6671
6671
  protected _snapshotOptions<TK, TV, TR>(): BSTOptions<TK, TV, TR>;
6672
6672
  ```
6673
6673
 
6674
- Defined in: [data-structures/binary-tree/bst.ts:3202](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3202)
6674
+ 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)
6675
6675
 
6676
6676
  (Protected) Snapshots the current BST's configuration options.
6677
6677
 
@@ -6711,7 +6711,7 @@ Time O(1)
6711
6711
  protected _successorOf(node): RedBlackTreeNode<K, V> | undefined;
6712
6712
  ```
6713
6713
 
6714
- Defined in: [data-structures/binary-tree/red-black-tree.ts:543](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L543)
6714
+ Defined in: [data-structures/binary-tree/red-black-tree.ts:555](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L555)
6715
6715
 
6716
6716
  (Internal) In-order successor of a node in a BST.
6717
6717
 
@@ -6737,7 +6737,7 @@ Time O(log n) average, Space O(1)
6737
6737
  protected _swapProperties(srcNode, destNode): BinaryTreeNode<K, V> | undefined;
6738
6738
  ```
6739
6739
 
6740
- Defined in: [data-structures/binary-tree/binary-tree.ts:3445](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3445)
6740
+ Defined in: [data-structures/binary-tree/binary-tree.ts:3520](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3520)
6741
6741
 
6742
6742
  (Protected) Swaps the key/value properties of two nodes.
6743
6743
 
@@ -6785,7 +6785,7 @@ Time O(1)
6785
6785
  protected _transplant(u, v): void;
6786
6786
  ```
6787
6787
 
6788
- Defined in: [data-structures/binary-tree/red-black-tree.ts:1778](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L1778)
6788
+ Defined in: [data-structures/binary-tree/red-black-tree.ts:1835](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/red-black-tree.ts#L1835)
6789
6789
 
6790
6790
  (Protected) Transplant a subtree in place of another during deletion.
6791
6791
 
@@ -6821,7 +6821,7 @@ Time O(1), Space O(1)
6821
6821
  protected _updateCount(node): void;
6822
6822
  ```
6823
6823
 
6824
- Defined in: [data-structures/binary-tree/bst.ts:3237](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3237)
6824
+ 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)
6825
6825
 
6826
6826
  (Protected) Recalculates the subtree count for a single node.
6827
6827
 
@@ -6851,7 +6851,7 @@ Time O(1). Only active when enableOrderStatistic is true.
6851
6851
  protected _updateCountAlongPath(node): void;
6852
6852
  ```
6853
6853
 
6854
- Defined in: [data-structures/binary-tree/bst.ts:3248](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3248)
6854
+ 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)
6855
6855
 
6856
6856
  (Protected) Updates subtree counts from a node up to the root.
6857
6857