data-structure-typed 2.5.1 → 2.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/CHANGELOG.md +3 -1
  2. package/README.md +75 -17
  3. package/dist/cjs/binary-tree.cjs +2723 -139
  4. package/dist/cjs/graph.cjs +192 -6
  5. package/dist/cjs/hash.cjs +63 -15
  6. package/dist/cjs/heap.cjs +93 -31
  7. package/dist/cjs/index.cjs +3514 -379
  8. package/dist/cjs/linked-list.cjs +237 -31
  9. package/dist/cjs/matrix.cjs +47 -9
  10. package/dist/cjs/priority-queue.cjs +92 -30
  11. package/dist/cjs/queue.cjs +176 -2
  12. package/dist/cjs/stack.cjs +48 -2
  13. package/dist/cjs/trie.cjs +78 -28
  14. package/dist/cjs-legacy/binary-tree.cjs +2725 -136
  15. package/dist/cjs-legacy/graph.cjs +192 -6
  16. package/dist/cjs-legacy/hash.cjs +63 -15
  17. package/dist/cjs-legacy/heap.cjs +93 -31
  18. package/dist/cjs-legacy/index.cjs +3389 -249
  19. package/dist/cjs-legacy/linked-list.cjs +237 -31
  20. package/dist/cjs-legacy/matrix.cjs +47 -9
  21. package/dist/cjs-legacy/priority-queue.cjs +92 -30
  22. package/dist/cjs-legacy/queue.cjs +176 -2
  23. package/dist/cjs-legacy/stack.cjs +48 -2
  24. package/dist/cjs-legacy/trie.cjs +78 -28
  25. package/dist/esm/binary-tree.mjs +2723 -139
  26. package/dist/esm/graph.mjs +192 -6
  27. package/dist/esm/hash.mjs +63 -15
  28. package/dist/esm/heap.mjs +93 -31
  29. package/dist/esm/index.mjs +3514 -380
  30. package/dist/esm/linked-list.mjs +237 -31
  31. package/dist/esm/matrix.mjs +47 -9
  32. package/dist/esm/priority-queue.mjs +92 -30
  33. package/dist/esm/queue.mjs +176 -2
  34. package/dist/esm/stack.mjs +48 -2
  35. package/dist/esm/trie.mjs +78 -28
  36. package/dist/esm-legacy/binary-tree.mjs +2725 -136
  37. package/dist/esm-legacy/graph.mjs +192 -6
  38. package/dist/esm-legacy/hash.mjs +63 -15
  39. package/dist/esm-legacy/heap.mjs +93 -31
  40. package/dist/esm-legacy/index.mjs +3389 -250
  41. package/dist/esm-legacy/linked-list.mjs +237 -31
  42. package/dist/esm-legacy/matrix.mjs +47 -9
  43. package/dist/esm-legacy/priority-queue.mjs +92 -30
  44. package/dist/esm-legacy/queue.mjs +176 -2
  45. package/dist/esm-legacy/stack.mjs +48 -2
  46. package/dist/esm-legacy/trie.mjs +78 -28
  47. package/dist/types/common/error.d.ts +9 -0
  48. package/dist/types/common/index.d.ts +1 -1
  49. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +48 -0
  50. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +56 -0
  51. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +102 -2
  52. package/dist/types/data-structures/binary-tree/bst.d.ts +195 -0
  53. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +76 -0
  54. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +24 -0
  55. package/dist/types/data-structures/binary-tree/tree-map.d.ts +528 -0
  56. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +531 -6
  57. package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +435 -6
  58. package/dist/types/data-structures/binary-tree/tree-set.d.ts +505 -0
  59. package/dist/types/data-structures/graph/directed-graph.d.ts +40 -0
  60. package/dist/types/data-structures/graph/undirected-graph.d.ts +36 -0
  61. package/dist/types/data-structures/hash/hash-map.d.ts +44 -0
  62. package/dist/types/data-structures/heap/heap.d.ts +56 -0
  63. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +68 -0
  64. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +60 -0
  65. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +72 -0
  66. package/dist/types/data-structures/matrix/matrix.d.ts +32 -0
  67. package/dist/types/data-structures/queue/deque.d.ts +60 -0
  68. package/dist/types/data-structures/queue/queue.d.ts +48 -0
  69. package/dist/types/data-structures/stack/stack.d.ts +40 -0
  70. package/dist/types/data-structures/trie/trie.d.ts +48 -0
  71. package/dist/types/types/data-structures/binary-tree/bst.d.ts +1 -0
  72. package/dist/types/types/data-structures/binary-tree/tree-map.d.ts +5 -0
  73. package/dist/types/types/data-structures/binary-tree/tree-multi-set.d.ts +4 -0
  74. package/dist/types/types/data-structures/binary-tree/tree-set.d.ts +4 -0
  75. package/dist/umd/data-structure-typed.js +3404 -265
  76. package/dist/umd/data-structure-typed.min.js +5 -5
  77. package/docs-site-docusaurus/docs/api/classes/AVLTree.md +650 -136
  78. package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +11 -11
  79. package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +71 -71
  80. package/docs-site-docusaurus/docs/api/classes/BST.md +591 -129
  81. package/docs-site-docusaurus/docs/api/classes/BSTNode.md +13 -13
  82. package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +15 -15
  83. package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +107 -107
  84. package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +13 -13
  85. package/docs-site-docusaurus/docs/api/classes/Deque.md +82 -82
  86. package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +82 -82
  87. package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +74 -74
  88. package/docs-site-docusaurus/docs/api/classes/DoublyLinkedListNode.md +8 -8
  89. package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +9 -9
  90. package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +1 -1
  91. package/docs-site-docusaurus/docs/api/classes/HashMap.md +47 -47
  92. package/docs-site-docusaurus/docs/api/classes/Heap.md +45 -45
  93. package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +25 -25
  94. package/docs-site-docusaurus/docs/api/classes/IterableEntryBase.md +33 -33
  95. package/docs-site-docusaurus/docs/api/classes/LinearBase.md +50 -50
  96. package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +55 -55
  97. package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +49 -49
  98. package/docs-site-docusaurus/docs/api/classes/LinkedListNode.md +6 -6
  99. package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +78 -78
  100. package/docs-site-docusaurus/docs/api/classes/MapGraph.md +82 -82
  101. package/docs-site-docusaurus/docs/api/classes/Matrix.md +31 -31
  102. package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +45 -45
  103. package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +45 -45
  104. package/docs-site-docusaurus/docs/api/classes/MinHeap.md +45 -45
  105. package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +45 -45
  106. package/docs-site-docusaurus/docs/api/classes/Navigator.md +5 -5
  107. package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +44 -44
  108. package/docs-site-docusaurus/docs/api/classes/Queue.md +60 -60
  109. package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +660 -146
  110. package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +10 -10
  111. package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +78 -78
  112. package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +6 -6
  113. package/docs-site-docusaurus/docs/api/classes/SkipList.md +44 -44
  114. package/docs-site-docusaurus/docs/api/classes/Stack.md +39 -39
  115. package/docs-site-docusaurus/docs/api/classes/TreeMap.md +165 -33
  116. package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +162 -46
  117. package/docs-site-docusaurus/docs/api/classes/TreeSet.md +161 -32
  118. package/docs-site-docusaurus/docs/api/classes/Trie.md +47 -47
  119. package/docs-site-docusaurus/docs/api/classes/TrieNode.md +8 -8
  120. package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +81 -81
  121. package/docs-site-docusaurus/docs/guide/architecture.md +2 -0
  122. package/docs-site-docusaurus/docs/guide/concepts.md +32 -1
  123. package/docs-site-docusaurus/docs/guide/faq.md +180 -0
  124. package/docs-site-docusaurus/docs/guide/guides.md +40 -54
  125. package/docs-site-docusaurus/docs/guide/installation.md +2 -0
  126. package/docs-site-docusaurus/docs/guide/integrations.md +2 -0
  127. package/docs-site-docusaurus/docs/guide/overview.md +7 -0
  128. package/docs-site-docusaurus/docs/guide/performance.md +2 -0
  129. package/docs-site-docusaurus/docs/guide/quick-start.md +31 -0
  130. package/docs-site-docusaurus/docs/guide/use-cases/_category_.json +6 -0
  131. package/docs-site-docusaurus/docs/guide/use-cases/array-sort-alternative.md +158 -0
  132. package/docs-site-docusaurus/docs/guide/use-cases/heap-vs-sorting.md +92 -0
  133. package/docs-site-docusaurus/docs/guide/use-cases/map-vs-treemap.md +151 -0
  134. package/docs-site-docusaurus/docs/guide/use-cases/priority-queue-typescript.md +113 -0
  135. package/docs-site-docusaurus/docs/guide/use-cases/treemap-javascript.md +151 -0
  136. package/docs-site-docusaurus/docusaurus.config.ts +1 -1
  137. package/docs-site-docusaurus/src/pages/index.tsx +51 -2
  138. package/docs-site-docusaurus/static/llms.txt +37 -0
  139. package/llms.txt +37 -0
  140. package/package.json +64 -56
  141. package/src/common/error.ts +19 -1
  142. package/src/common/index.ts +1 -1
  143. package/src/data-structures/base/iterable-element-base.ts +3 -2
  144. package/src/data-structures/binary-tree/avl-tree.ts +47 -0
  145. package/src/data-structures/binary-tree/binary-indexed-tree.ts +46 -4
  146. package/src/data-structures/binary-tree/binary-tree.ts +79 -4
  147. package/src/data-structures/binary-tree/bst.ts +441 -6
  148. package/src/data-structures/binary-tree/red-black-tree.ts +73 -0
  149. package/src/data-structures/binary-tree/segment-tree.ts +18 -0
  150. package/src/data-structures/binary-tree/tree-map.ts +434 -9
  151. package/src/data-structures/binary-tree/tree-multi-map.ts +426 -5
  152. package/src/data-structures/binary-tree/tree-multi-set.ts +350 -6
  153. package/src/data-structures/binary-tree/tree-set.ts +410 -8
  154. package/src/data-structures/graph/abstract-graph.ts +2 -2
  155. package/src/data-structures/graph/directed-graph.ts +30 -0
  156. package/src/data-structures/graph/undirected-graph.ts +27 -0
  157. package/src/data-structures/hash/hash-map.ts +35 -4
  158. package/src/data-structures/heap/heap.ts +46 -4
  159. package/src/data-structures/heap/max-heap.ts +2 -2
  160. package/src/data-structures/linked-list/doubly-linked-list.ts +51 -0
  161. package/src/data-structures/linked-list/singly-linked-list.ts +45 -0
  162. package/src/data-structures/linked-list/skip-linked-list.ts +59 -5
  163. package/src/data-structures/matrix/matrix.ts +33 -9
  164. package/src/data-structures/priority-queue/max-priority-queue.ts +2 -2
  165. package/src/data-structures/queue/deque.ts +45 -0
  166. package/src/data-structures/queue/queue.ts +36 -0
  167. package/src/data-structures/stack/stack.ts +30 -0
  168. package/src/data-structures/trie/trie.ts +38 -2
  169. package/src/types/data-structures/binary-tree/bst.ts +1 -0
  170. package/src/types/data-structures/binary-tree/tree-map.ts +6 -0
  171. package/src/types/data-structures/binary-tree/tree-multi-set.ts +5 -0
  172. package/src/types/data-structures/binary-tree/tree-set.ts +5 -0
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Class: BST\<K, V, R\>
8
8
 
9
- Defined in: [data-structures/binary-tree/bst.ts:327](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L327)
9
+ Defined in: [data-structures/binary-tree/bst.ts:327](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L327)
10
10
 
11
11
  Represents a Binary Search Tree (BST).
12
12
  Keys are ordered, allowing for faster search operations compared to a standard Binary Tree.
@@ -188,7 +188,7 @@ The type of the raw data object (if using `toEntryFn`).
188
188
  new BST<K, V, R>(keysNodesEntriesOrRaws?, options?): BST<K, V, R>;
189
189
  ```
190
190
 
191
- Defined in: [data-structures/binary-tree/bst.ts:335](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L335)
191
+ Defined in: [data-structures/binary-tree/bst.ts:335](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L335)
192
192
 
193
193
  Creates an instance of BST.
194
194
 
@@ -234,7 +234,7 @@ Time O(N log N) or O(N^2) depending on `isBalanceAdd` in `addMany` and input ord
234
234
  get comparator(): Comparator<K>;
235
235
  ```
236
236
 
237
- Defined in: [data-structures/binary-tree/bst.ts:380](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L380)
237
+ Defined in: [data-structures/binary-tree/bst.ts:385](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L385)
238
238
 
239
239
  Gets the comparator function used by the tree.
240
240
 
@@ -258,7 +258,7 @@ The comparator function.
258
258
  get isDuplicate(): boolean;
259
259
  ```
260
260
 
261
- Defined in: [data-structures/binary-tree/binary-tree.ts:322](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L322)
261
+ Defined in: [data-structures/binary-tree/binary-tree.ts:322](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L322)
262
262
 
263
263
  Gets whether the tree allows duplicate keys.
264
264
 
@@ -292,7 +292,7 @@ IBinaryTree.isDuplicate
292
292
  get isMapMode(): boolean;
293
293
  ```
294
294
 
295
- Defined in: [data-structures/binary-tree/binary-tree.ts:310](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L310)
295
+ Defined in: [data-structures/binary-tree/binary-tree.ts:310](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L310)
296
296
 
297
297
  Gets whether the tree is in Map mode.
298
298
 
@@ -326,7 +326,7 @@ IBinaryTree.isMapMode
326
326
  get NIL(): BinaryTreeNode<K, V>;
327
327
  ```
328
328
 
329
- Defined in: [data-structures/binary-tree/binary-tree.ts:373](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L373)
329
+ Defined in: [data-structures/binary-tree/binary-tree.ts:373](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L373)
330
330
 
331
331
  Gets the sentinel NIL node (used in self-balancing trees like Red-Black Tree).
332
332
 
@@ -360,7 +360,7 @@ IBinaryTree.NIL
360
360
  get root(): OptNode<BSTNode<K, V>>;
361
361
  ```
362
362
 
363
- Defined in: [data-structures/binary-tree/bst.ts:363](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L363)
363
+ Defined in: [data-structures/binary-tree/bst.ts:368](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L368)
364
364
 
365
365
  Gets the root node of the tree.
366
366
 
@@ -394,7 +394,7 @@ IBinaryTree.root
394
394
  get size(): number;
395
395
  ```
396
396
 
397
- Defined in: [data-structures/binary-tree/binary-tree.ts:361](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L361)
397
+ Defined in: [data-structures/binary-tree/binary-tree.ts:361](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L361)
398
398
 
399
399
  Gets the number of nodes in the tree.
400
400
 
@@ -428,7 +428,7 @@ IBinaryTree.size
428
428
  get store(): Map<K, BinaryTreeNode<K, V>>;
429
429
  ```
430
430
 
431
- Defined in: [data-structures/binary-tree/binary-tree.ts:337](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L337)
431
+ Defined in: [data-structures/binary-tree/binary-tree.ts:337](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L337)
432
432
 
433
433
  Gets the external value store (used in Map mode).
434
434
 
@@ -462,7 +462,7 @@ IBinaryTree.store
462
462
  get toEntryFn(): ToEntryFn<K, V, R> | undefined;
463
463
  ```
464
464
 
465
- Defined in: [data-structures/binary-tree/binary-tree.ts:385](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L385)
465
+ Defined in: [data-structures/binary-tree/binary-tree.ts:385](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L385)
466
466
 
467
467
  Gets the function used to convert raw data objects (R) into [key, value] entries.
468
468
 
@@ -494,7 +494,7 @@ IBinaryTree.toEntryFn
494
494
  iterator: IterableIterator<[K, V | undefined]>;
495
495
  ```
496
496
 
497
- Defined in: [data-structures/base/iterable-entry-base.ts:22](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/base/iterable-entry-base.ts#L22)
497
+ Defined in: [data-structures/base/iterable-entry-base.ts:22](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L22)
498
498
 
499
499
  Default iterator yielding `[key, value]` entries.
500
500
 
@@ -502,7 +502,7 @@ Default iterator yielding `[key, value]` entries.
502
502
 
503
503
  ##### args
504
504
 
505
- ...`any`[]
505
+ ...`unknown`[]
506
506
 
507
507
  #### Returns
508
508
 
@@ -532,7 +532,7 @@ IBinaryTree.[iterator]
532
532
  add(keyNodeOrEntry): boolean;
533
533
  ```
534
534
 
535
- Defined in: [data-structures/binary-tree/binary-tree.ts:601](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L601)
535
+ Defined in: [data-structures/binary-tree/binary-tree.ts:608](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L608)
536
536
 
537
537
  Adds a new node to the tree.
538
538
 
@@ -590,7 +590,7 @@ IBinaryTree.add
590
590
  addMany(keysNodesEntriesOrRaws): boolean[];
591
591
  ```
592
592
 
593
- Defined in: [data-structures/binary-tree/binary-tree.ts:760](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L760)
593
+ Defined in: [data-structures/binary-tree/binary-tree.ts:781](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L781)
594
594
 
595
595
  Adds multiple items to the tree.
596
596
 
@@ -671,7 +671,7 @@ The traversal method.
671
671
  bfs(): (K | undefined)[];
672
672
  ```
673
673
 
674
- Defined in: [data-structures/binary-tree/bst.ts:587](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L587)
674
+ Defined in: [data-structures/binary-tree/bst.ts:620](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L620)
675
675
 
676
676
  BinaryTree level-order traversal
677
677
 
@@ -709,7 +709,7 @@ bfs<C>(
709
709
  iterationType?): ReturnType<C>[];
710
710
  ```
711
711
 
712
- Defined in: [data-structures/binary-tree/bst.ts:588](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L588)
712
+ Defined in: [data-structures/binary-tree/bst.ts:621](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L621)
713
713
 
714
714
  BinaryTree level-order traversal
715
715
 
@@ -771,7 +771,7 @@ IBinaryTree.bfs
771
771
  ceiling(keyNodeEntryOrPredicate): K | undefined;
772
772
  ```
773
773
 
774
- Defined in: [data-structures/binary-tree/bst.ts:1429](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L1429)
774
+ Defined in: [data-structures/binary-tree/bst.ts:1782](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1782)
775
775
 
776
776
  Returns the first key with a value >= target.
777
777
  Equivalent to Java TreeMap.ceiling.
@@ -814,7 +814,7 @@ ceiling<C>(
814
814
  iterationType?): ReturnType<C>;
815
815
  ```
816
816
 
817
- Defined in: [data-structures/binary-tree/bst.ts:1444](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L1444)
817
+ Defined in: [data-structures/binary-tree/bst.ts:1797](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1797)
818
818
 
819
819
  Returns the first node with a key >= target and applies callback.
820
820
  Time Complexity: O(log n) average, O(h) worst case.
@@ -857,7 +857,7 @@ Space Complexity: O(h) for recursion, O(1) for iteration.
857
857
  clear(): void;
858
858
  ```
859
859
 
860
- Defined in: [data-structures/binary-tree/binary-tree.ts:1425](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L1425)
860
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1509](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1509)
861
861
 
862
862
  Clears the tree of all nodes and values.
863
863
 
@@ -898,7 +898,7 @@ IBinaryTree.clear
898
898
  clone(): this;
899
899
  ```
900
900
 
901
- Defined in: [data-structures/binary-tree/binary-tree.ts:2543](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L2543)
901
+ Defined in: [data-structures/binary-tree/binary-tree.ts:2697](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2697)
902
902
 
903
903
  Clones the tree.
904
904
 
@@ -942,7 +942,7 @@ IBinaryTree.clone
942
942
  createNode(key, value?): BSTNode<K, V>;
943
943
  ```
944
944
 
945
- Defined in: [data-structures/binary-tree/bst.ts:392](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L392)
945
+ Defined in: [data-structures/binary-tree/bst.ts:397](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L397)
946
946
 
947
947
  (Protected) Creates a new BST node.
948
948
 
@@ -988,7 +988,7 @@ IBinaryTree.createNode
988
988
  createTree(options?): this;
989
989
  ```
990
990
 
991
- Defined in: [data-structures/binary-tree/binary-tree.ts:408](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L408)
991
+ Defined in: [data-structures/binary-tree/binary-tree.ts:408](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L408)
992
992
 
993
993
  Creates a new, empty tree of the same type and configuration.
994
994
 
@@ -1028,7 +1028,7 @@ IBinaryTree.createTree
1028
1028
  delete(keyNodeEntryRawOrPredicate): BinaryTreeDeleteResult<BinaryTreeNode<K, V>>[];
1029
1029
  ```
1030
1030
 
1031
- Defined in: [data-structures/binary-tree/binary-tree.ts:929](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L929)
1031
+ Defined in: [data-structures/binary-tree/binary-tree.ts:971](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L971)
1032
1032
 
1033
1033
  Deletes a node from the tree.
1034
1034
 
@@ -1085,7 +1085,7 @@ deleteWhere(
1085
1085
  iterationType?): BinaryTreeDeleteResult<BSTNode<K, V>>[];
1086
1086
  ```
1087
1087
 
1088
- Defined in: [data-structures/binary-tree/bst.ts:2195](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L2195)
1088
+ Defined in: [data-structures/binary-tree/bst.ts:2597](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2597)
1089
1089
 
1090
1090
  Deletes nodes that match a key, node, entry, predicate, or range.
1091
1091
 
@@ -1192,7 +1192,7 @@ The traversal method.
1192
1192
  dfs(): (K | undefined)[];
1193
1193
  ```
1194
1194
 
1195
- Defined in: [data-structures/binary-tree/bst.ts:499](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L499)
1195
+ Defined in: [data-structures/binary-tree/bst.ts:518](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L518)
1196
1196
 
1197
1197
  Depth-first search traversal
1198
1198
 
@@ -1232,7 +1232,7 @@ dfs<C>(
1232
1232
  iterationType?): ReturnType<C>[];
1233
1233
  ```
1234
1234
 
1235
- Defined in: [data-structures/binary-tree/bst.ts:501](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L501)
1235
+ Defined in: [data-structures/binary-tree/bst.ts:520](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L520)
1236
1236
 
1237
1237
  Depth-first search traversal
1238
1238
 
@@ -1300,7 +1300,7 @@ IBinaryTree.dfs
1300
1300
  ensureNode(keyNodeOrEntry, iterationType?): OptNode<BSTNode<K, V>>;
1301
1301
  ```
1302
1302
 
1303
- Defined in: [data-structures/binary-tree/bst.ts:404](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L404)
1303
+ Defined in: [data-structures/binary-tree/bst.ts:409](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L409)
1304
1304
 
1305
1305
  Ensures the input is a node. If it's a key or entry, it searches for the node.
1306
1306
 
@@ -1344,7 +1344,7 @@ Time O(log N) (height of the tree), O(N) worst-case.
1344
1344
  entries(): IterableIterator<[K, V | undefined]>;
1345
1345
  ```
1346
1346
 
1347
- Defined in: [data-structures/base/iterable-entry-base.ts:31](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/base/iterable-entry-base.ts#L31)
1347
+ Defined in: [data-structures/base/iterable-entry-base.ts:31](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L31)
1348
1348
 
1349
1349
  Iterate over `[key, value]` pairs (may yield `undefined` values).
1350
1350
 
@@ -1376,7 +1376,7 @@ IBinaryTree.entries
1376
1376
  every(predicate, thisArg?): boolean;
1377
1377
  ```
1378
1378
 
1379
- Defined in: [data-structures/base/iterable-entry-base.ts:66](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/base/iterable-entry-base.ts#L66)
1379
+ Defined in: [data-structures/base/iterable-entry-base.ts:66](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L66)
1380
1380
 
1381
1381
  Test whether all entries satisfy the predicate.
1382
1382
 
@@ -1390,7 +1390,7 @@ Test whether all entries satisfy the predicate.
1390
1390
 
1391
1391
  ##### thisArg?
1392
1392
 
1393
- `any`
1393
+ `unknown`
1394
1394
 
1395
1395
  Optional `this` for callback.
1396
1396
 
@@ -1422,7 +1422,7 @@ IBinaryTree.every
1422
1422
  filter(predicate, thisArg?): this;
1423
1423
  ```
1424
1424
 
1425
- Defined in: [data-structures/binary-tree/binary-tree.ts:2588](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L2588)
1425
+ Defined in: [data-structures/binary-tree/binary-tree.ts:2749](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2749)
1426
1426
 
1427
1427
  Creates a new tree containing only the entries that satisfy the predicate.
1428
1428
 
@@ -1479,7 +1479,7 @@ IBinaryTree.filter
1479
1479
  find(callbackfn, thisArg?): [K, V | undefined] | undefined;
1480
1480
  ```
1481
1481
 
1482
- Defined in: [data-structures/base/iterable-entry-base.ts:114](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/base/iterable-entry-base.ts#L114)
1482
+ Defined in: [data-structures/base/iterable-entry-base.ts:114](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L114)
1483
1483
 
1484
1484
  Find the first entry that matches a predicate.
1485
1485
 
@@ -1493,7 +1493,7 @@ Find the first entry that matches a predicate.
1493
1493
 
1494
1494
  ##### thisArg?
1495
1495
 
1496
- `any`
1496
+ `unknown`
1497
1497
 
1498
1498
  Optional `this` for callback.
1499
1499
 
@@ -1527,7 +1527,7 @@ IBinaryTree.find
1527
1527
  floor(keyNodeEntryOrPredicate): K | undefined;
1528
1528
  ```
1529
1529
 
1530
- Defined in: [data-structures/binary-tree/bst.ts:1626](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L1626)
1530
+ Defined in: [data-structures/binary-tree/bst.ts:1993](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1993)
1531
1531
 
1532
1532
  Returns the first key with a value <= target.
1533
1533
  Equivalent to Java TreeMap.floor.
@@ -1570,7 +1570,7 @@ floor<C>(
1570
1570
  iterationType?): ReturnType<C>;
1571
1571
  ```
1572
1572
 
1573
- Defined in: [data-structures/binary-tree/bst.ts:1641](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L1641)
1573
+ Defined in: [data-structures/binary-tree/bst.ts:2008](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2008)
1574
1574
 
1575
1575
  Returns the first node with a key <= target and applies callback.
1576
1576
  Time Complexity: O(log n) average, O(h) worst case.
@@ -1613,7 +1613,7 @@ Space Complexity: O(h) for recursion, O(1) for iteration.
1613
1613
  forEach(callbackfn, thisArg?): void;
1614
1614
  ```
1615
1615
 
1616
- Defined in: [data-structures/base/iterable-entry-base.ts:99](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/base/iterable-entry-base.ts#L99)
1616
+ Defined in: [data-structures/base/iterable-entry-base.ts:99](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L99)
1617
1617
 
1618
1618
  Visit each entry, left-to-right.
1619
1619
 
@@ -1627,7 +1627,7 @@ Visit each entry, left-to-right.
1627
1627
 
1628
1628
  ##### thisArg?
1629
1629
 
1630
- `any`
1630
+ `unknown`
1631
1631
 
1632
1632
  Optional `this` for callback.
1633
1633
 
@@ -1660,7 +1660,7 @@ get(
1660
1660
  iterationType?): V | undefined;
1661
1661
  ```
1662
1662
 
1663
- Defined in: [data-structures/binary-tree/binary-tree.ts:1279](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L1279)
1663
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1349](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1349)
1664
1664
 
1665
1665
  Gets the value associated with a key.
1666
1666
 
@@ -1724,13 +1724,106 @@ IBinaryTree.get
1724
1724
 
1725
1725
  ***
1726
1726
 
1727
+ ### getByRank()
1728
+
1729
+ #### Call Signature
1730
+
1731
+ ```ts
1732
+ getByRank(k): K | undefined;
1733
+ ```
1734
+
1735
+ Defined in: [data-structures/binary-tree/bst.ts:1197](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1197)
1736
+
1737
+ Returns the element at the k-th position in tree order (0-indexed).
1738
+
1739
+ ##### Parameters
1740
+
1741
+ ###### k
1742
+
1743
+ `number`
1744
+
1745
+ The 0-based position in tree order (0 = first element).
1746
+
1747
+ ##### Returns
1748
+
1749
+ `K` \| `undefined`
1750
+
1751
+ The key at position k, or `undefined` if out of bounds.
1752
+ *
1753
+
1754
+ ##### Remarks
1755
+
1756
+ Time O(log n), Space O(1) iterative / O(log n) recursive. Requires `enableOrderStatistic: true`.
1757
+ Tree order is defined by the comparator — ascending by default, but respects custom comparators (e.g. descending).
1758
+
1759
+ ##### Example
1760
+
1761
+ ```ts
1762
+ // Order-statistic on BST
1763
+ const tree = new BST<number>([30, 10, 50, 20, 40], { enableOrderStatistic: true });
1764
+ console.log(tree.getByRank(0)); // 10;
1765
+ console.log(tree.getByRank(4)); // 50;
1766
+ console.log(tree.getRank(30)); // 2;
1767
+ ```
1768
+
1769
+ #### Call Signature
1770
+
1771
+ ```ts
1772
+ getByRank<C>(
1773
+ k,
1774
+ callback,
1775
+ iterationType?): ReturnType<C> | undefined;
1776
+ ```
1777
+
1778
+ Defined in: [data-structures/binary-tree/bst.ts:1208](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1208)
1779
+
1780
+ Returns the element at the k-th position in tree order and applies a callback.
1781
+
1782
+ ##### Type Parameters
1783
+
1784
+ ###### C
1785
+
1786
+ `C` *extends* `NodeCallback`\<[`BSTNode`](BSTNode.md)\<`K`, `V`\>\>
1787
+
1788
+ ##### Parameters
1789
+
1790
+ ###### k
1791
+
1792
+ `number`
1793
+
1794
+ The 0-based position in tree order (0 = first element).
1795
+
1796
+ ###### callback
1797
+
1798
+ `C`
1799
+
1800
+ Callback to apply to the found node.
1801
+
1802
+ ###### iterationType?
1803
+
1804
+ `IterationType`
1805
+
1806
+ Iteration strategy ('ITERATIVE' or 'RECURSIVE').
1807
+
1808
+ ##### Returns
1809
+
1810
+ `ReturnType`\<`C`\> \| `undefined`
1811
+
1812
+ The callback result, or `undefined` if out of bounds.
1813
+
1814
+ ##### Remarks
1815
+
1816
+ Time O(log n), Space O(1) iterative / O(log n) recursive. Requires `enableOrderStatistic: true`.
1817
+
1818
+ ***
1819
+
1727
1820
  ### getDepth()
1728
1821
 
1729
1822
  ```ts
1730
1823
  getDepth(dist, startNode?): number;
1731
1824
  ```
1732
1825
 
1733
- Defined in: [data-structures/binary-tree/binary-tree.ts:1605](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L1605)
1826
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1710](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1710)
1734
1827
 
1735
1828
  Gets the depth of a node (distance from `startNode`).
1736
1829
 
@@ -1794,7 +1887,7 @@ IBinaryTree.getDepth
1794
1887
  getHeight(startNode?, iterationType?): number;
1795
1888
  ```
1796
1889
 
1797
- Defined in: [data-structures/binary-tree/binary-tree.ts:1662](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L1662)
1890
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1774](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1774)
1798
1891
 
1799
1892
  Gets the maximum height of the tree (longest path from startNode to a leaf).
1800
1893
 
@@ -1877,7 +1970,7 @@ The traversal method.
1877
1970
  getLeftMost(): K | undefined;
1878
1971
  ```
1879
1972
 
1880
- Defined in: [data-structures/binary-tree/binary-tree.ts:1789](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L1789)
1973
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1901](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1901)
1881
1974
 
1882
1975
  ##### Returns
1883
1976
 
@@ -1902,7 +1995,7 @@ getLeftMost<C>(
1902
1995
  iterationType?): ReturnType<C>;
1903
1996
  ```
1904
1997
 
1905
- Defined in: [data-structures/binary-tree/binary-tree.ts:1791](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L1791)
1998
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1903](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1903)
1906
1999
 
1907
2000
  ##### Type Parameters
1908
2001
 
@@ -1949,7 +2042,7 @@ IBinaryTree.getLeftMost
1949
2042
  getMinHeight(startNode?, iterationType?): number;
1950
2043
  ```
1951
2044
 
1952
- Defined in: [data-structures/binary-tree/binary-tree.ts:1704](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L1704)
2045
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1816](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1816)
1953
2046
 
1954
2047
  Gets the minimum height of the tree (shortest path from startNode to a leaf).
1955
2048
 
@@ -2001,7 +2094,7 @@ getNode(
2001
2094
  iterationType?): OptNode<BSTNode<K, V>>;
2002
2095
  ```
2003
2096
 
2004
- Defined in: [data-structures/binary-tree/bst.ts:768](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L768)
2097
+ Defined in: [data-structures/binary-tree/bst.ts:829](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L829)
2005
2098
 
2006
2099
  Gets the first node matching a predicate.
2007
2100
 
@@ -2074,7 +2167,7 @@ getNodes(
2074
2167
  iterationType?): BinaryTreeNode<K, V>[];
2075
2168
  ```
2076
2169
 
2077
- Defined in: [data-structures/binary-tree/binary-tree.ts:1149](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L1149)
2170
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1205](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1205)
2078
2171
 
2079
2172
  Gets all nodes matching a predicate.
2080
2173
 
@@ -2169,7 +2262,7 @@ If true, returns the path from root-to-node.
2169
2262
  getPathToRoot(beginNode): (K | undefined)[];
2170
2263
  ```
2171
2264
 
2172
- Defined in: [data-structures/binary-tree/binary-tree.ts:1751](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L1751)
2265
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1863](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1863)
2173
2266
 
2174
2267
  ##### Parameters
2175
2268
 
@@ -2204,7 +2297,7 @@ getPathToRoot<C>(
2204
2297
  isReverse?): ReturnType<C>[];
2205
2298
  ```
2206
2299
 
2207
- Defined in: [data-structures/binary-tree/binary-tree.ts:1755](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L1755)
2300
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1867](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1867)
2208
2301
 
2209
2302
  ##### Type Parameters
2210
2303
 
@@ -2252,7 +2345,7 @@ IBinaryTree.getPathToRoot
2252
2345
  getPredecessor(node): BinaryTreeNode<K, V>;
2253
2346
  ```
2254
2347
 
2255
- Defined in: [data-structures/binary-tree/binary-tree.ts:1889](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L1889)
2348
+ Defined in: [data-structures/binary-tree/binary-tree.ts:2001](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2001)
2256
2349
 
2257
2350
  Gets the Morris traversal predecessor (rightmost node in the left subtree, or node itself).
2258
2351
 
@@ -2280,6 +2373,83 @@ This is primarily a helper for Morris traversal. Time O(H), where H is the heigh
2280
2373
 
2281
2374
  ***
2282
2375
 
2376
+ ### getRank()
2377
+
2378
+ #### Call Signature
2379
+
2380
+ ```ts
2381
+ getRank(keyNodeEntryOrPredicate): number;
2382
+ ```
2383
+
2384
+ Defined in: [data-structures/binary-tree/bst.ts:1252](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1252)
2385
+
2386
+ Returns the 0-based rank of a key (number of elements that precede it in tree order).
2387
+
2388
+ ##### Parameters
2389
+
2390
+ ###### keyNodeEntryOrPredicate
2391
+
2392
+ \| `K`
2393
+ \| [`BSTNode`](BSTNode.md)\<`K`, `V`\>
2394
+ \| \[`K` \| `null` \| `undefined`, `V` \| `undefined`\]
2395
+ \| `NodePredicate`\<[`BSTNode`](BSTNode.md)\<`K`, `V`\>\>
2396
+ \| `null`
2397
+ \| `undefined`
2398
+
2399
+ The key, node, entry `[K, V]`, or predicate to find.
2400
+
2401
+ ##### Returns
2402
+
2403
+ `number`
2404
+
2405
+ The rank (0-indexed), or -1 if the tree is empty or input is invalid.
2406
+
2407
+ ##### Remarks
2408
+
2409
+ Time O(log n), Space O(1) iterative / O(log n) recursive. Requires `enableOrderStatistic: true`.
2410
+ Tree order is defined by the comparator. When the key is not found, returns the insertion position.
2411
+
2412
+ #### Call Signature
2413
+
2414
+ ```ts
2415
+ getRank(keyNodeEntryOrPredicate, iterationType): number;
2416
+ ```
2417
+
2418
+ Defined in: [data-structures/binary-tree/bst.ts:1270](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1270)
2419
+
2420
+ Returns the 0-based rank (number of preceding elements in tree order) with explicit iteration type.
2421
+
2422
+ ##### Parameters
2423
+
2424
+ ###### keyNodeEntryOrPredicate
2425
+
2426
+ \| `K`
2427
+ \| [`BSTNode`](BSTNode.md)\<`K`, `V`\>
2428
+ \| \[`K` \| `null` \| `undefined`, `V` \| `undefined`\]
2429
+ \| `NodePredicate`\<[`BSTNode`](BSTNode.md)\<`K`, `V`\>\>
2430
+ \| `null`
2431
+ \| `undefined`
2432
+
2433
+ The key, node, entry, or predicate to find.
2434
+
2435
+ ###### iterationType
2436
+
2437
+ `IterationType`
2438
+
2439
+ Iteration strategy ('ITERATIVE' or 'RECURSIVE').
2440
+
2441
+ ##### Returns
2442
+
2443
+ `number`
2444
+
2445
+ The rank (0-indexed), or -1 if the tree is empty or input is invalid.
2446
+
2447
+ ##### Remarks
2448
+
2449
+ Time O(log n), Space O(1) iterative / O(log n) recursive. Requires `enableOrderStatistic: true`.
2450
+
2451
+ ***
2452
+
2283
2453
  ### getRightMost()
2284
2454
 
2285
2455
  Finds the rightmost node in a subtree (the node with the largest key in a BST).
@@ -2310,7 +2480,7 @@ The traversal method.
2310
2480
  getRightMost(): K | undefined;
2311
2481
  ```
2312
2482
 
2313
- Defined in: [data-structures/binary-tree/binary-tree.ts:1836](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L1836)
2483
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1948](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1948)
2314
2484
 
2315
2485
  ##### Returns
2316
2486
 
@@ -2335,7 +2505,7 @@ getRightMost<C>(
2335
2505
  iterationType?): ReturnType<C>;
2336
2506
  ```
2337
2507
 
2338
- Defined in: [data-structures/binary-tree/binary-tree.ts:1838](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L1838)
2508
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1950](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1950)
2339
2509
 
2340
2510
  ##### Type Parameters
2341
2511
 
@@ -2382,7 +2552,7 @@ IBinaryTree.getRightMost
2382
2552
  getSuccessor(x?): BinaryTreeNode<K, V> | null | undefined;
2383
2553
  ```
2384
2554
 
2385
- Defined in: [data-structures/binary-tree/binary-tree.ts:1910](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L1910)
2555
+ Defined in: [data-structures/binary-tree/binary-tree.ts:2022](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2022)
2386
2556
 
2387
2557
  Gets the in-order successor of a node in a BST.
2388
2558
 
@@ -2419,7 +2589,7 @@ has(
2419
2589
  iterationType?): boolean;
2420
2590
  ```
2421
2591
 
2422
- Defined in: [data-structures/binary-tree/binary-tree.ts:1357](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L1357)
2592
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1434](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1434)
2423
2593
 
2424
2594
  Checks if a node matching the predicate exists in the tree.
2425
2595
 
@@ -2512,7 +2682,7 @@ IBinaryTree.has
2512
2682
  hasValue(value): boolean;
2513
2683
  ```
2514
2684
 
2515
- Defined in: [data-structures/base/iterable-entry-base.ts:143](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/base/iterable-entry-base.ts#L143)
2685
+ Defined in: [data-structures/base/iterable-entry-base.ts:143](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L143)
2516
2686
 
2517
2687
  Whether there exists an entry with the given value.
2518
2688
 
@@ -2554,7 +2724,7 @@ IBinaryTree.hasValue
2554
2724
  higher(keyNodeEntryOrPredicate): K | undefined;
2555
2725
  ```
2556
2726
 
2557
- Defined in: [data-structures/binary-tree/bst.ts:1527](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L1527)
2727
+ Defined in: [data-structures/binary-tree/bst.ts:1887](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1887)
2558
2728
 
2559
2729
  Returns the first key with a value > target.
2560
2730
  Equivalent to Java TreeMap.higher.
@@ -2596,7 +2766,7 @@ higher<C>(
2596
2766
  iterationType?): ReturnType<C>;
2597
2767
  ```
2598
2768
 
2599
- Defined in: [data-structures/binary-tree/bst.ts:1542](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L1542)
2769
+ Defined in: [data-structures/binary-tree/bst.ts:1902](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1902)
2600
2770
 
2601
2771
  Returns the first node with a key > target and applies callback.
2602
2772
  Time Complexity: O(log n) average, O(h) worst case.
@@ -2639,7 +2809,7 @@ Space Complexity: O(h) for recursion, O(1) for iteration.
2639
2809
  isAVLBalanced(iterationType?): boolean;
2640
2810
  ```
2641
2811
 
2642
- Defined in: [data-structures/binary-tree/bst.ts:2030](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L2030)
2812
+ Defined in: [data-structures/binary-tree/bst.ts:2418](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2418)
2643
2813
 
2644
2814
  Checks if the tree meets the AVL balance condition (height difference <= 1).
2645
2815
 
@@ -2679,7 +2849,7 @@ Time O(N), as it must visit every node to compute height. Space O(log N) for rec
2679
2849
  isBST(startNode?, iterationType?): boolean;
2680
2850
  ```
2681
2851
 
2682
- Defined in: [data-structures/binary-tree/binary-tree.ts:1521](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L1521)
2852
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1619](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1619)
2683
2853
 
2684
2854
  Checks if the tree is a valid Binary Search Tree (BST).
2685
2855
 
@@ -2739,7 +2909,7 @@ IBinaryTree.isBST
2739
2909
  isEmpty(): boolean;
2740
2910
  ```
2741
2911
 
2742
- Defined in: [data-structures/binary-tree/binary-tree.ts:1465](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L1465)
2912
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1556](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1556)
2743
2913
 
2744
2914
  Checks if the tree is empty.
2745
2915
 
@@ -2780,7 +2950,7 @@ IBinaryTree.isEmpty
2780
2950
  isEntry(keyNodeOrEntry): keyNodeOrEntry is BTNEntry<K, V>;
2781
2951
  ```
2782
2952
 
2783
- Defined in: [data-structures/binary-tree/binary-tree.ts:545](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L545)
2953
+ Defined in: [data-structures/binary-tree/binary-tree.ts:545](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L545)
2784
2954
 
2785
2955
  Checks if the given item is a [key, value] entry pair.
2786
2956
 
@@ -2818,7 +2988,7 @@ Time O(1), Space O(1)
2818
2988
  isLeaf(keyNodeOrEntry): boolean;
2819
2989
  ```
2820
2990
 
2821
- Defined in: [data-structures/binary-tree/binary-tree.ts:531](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L531)
2991
+ Defined in: [data-structures/binary-tree/binary-tree.ts:531](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L531)
2822
2992
 
2823
2993
  Checks if a node is a leaf (has no real children).
2824
2994
 
@@ -2856,7 +3026,7 @@ Time O(N) if a key/entry is passed (due to `ensureNode`). O(1) if a node is pass
2856
3026
  isNIL(keyNodeOrEntry): boolean;
2857
3027
  ```
2858
3028
 
2859
- Defined in: [data-structures/binary-tree/binary-tree.ts:500](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L500)
3029
+ Defined in: [data-structures/binary-tree/binary-tree.ts:500](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L500)
2860
3030
 
2861
3031
  Checks if the given item is the sentinel NIL node.
2862
3032
 
@@ -2894,7 +3064,7 @@ Time O(1), Space O(1)
2894
3064
  isNode(keyNodeOrEntry): keyNodeOrEntry is BSTNode<K, V>;
2895
3065
  ```
2896
3066
 
2897
- Defined in: [data-structures/binary-tree/bst.ts:418](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L418)
3067
+ Defined in: [data-structures/binary-tree/bst.ts:423](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L423)
2898
3068
 
2899
3069
  Checks if the given item is a `BSTNode` instance.
2900
3070
 
@@ -2932,7 +3102,7 @@ Time O(1), Space O(1)
2932
3102
  isPerfectlyBalanced(startNode?): boolean;
2933
3103
  ```
2934
3104
 
2935
- Defined in: [data-structures/binary-tree/binary-tree.ts:1476](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L1476)
3105
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1567](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1567)
2936
3106
 
2937
3107
  Checks if the tree is perfectly balanced.
2938
3108
 
@@ -2975,7 +3145,7 @@ IBinaryTree.isPerfectlyBalanced
2975
3145
  isRange(keyNodeEntryOrPredicate): keyNodeEntryOrPredicate is Range<K>;
2976
3146
  ```
2977
3147
 
2978
- Defined in: [data-structures/binary-tree/binary-tree.ts:511](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L511)
3148
+ Defined in: [data-structures/binary-tree/binary-tree.ts:511](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L511)
2979
3149
 
2980
3150
  Checks if the given item is a `Range` object.
2981
3151
 
@@ -3015,7 +3185,7 @@ Time O(1), Space O(1)
3015
3185
  isRaw(keyNodeEntryOrRaw): keyNodeEntryOrRaw is R;
3016
3186
  ```
3017
3187
 
3018
- Defined in: [data-structures/binary-tree/binary-tree.ts:460](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L460)
3188
+ Defined in: [data-structures/binary-tree/binary-tree.ts:460](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L460)
3019
3189
 
3020
3190
  Checks if the given item is a raw data object (R) that needs conversion via `toEntryFn`.
3021
3191
 
@@ -3054,7 +3224,7 @@ Time O(1), Space O(1)
3054
3224
  isRealNode(keyNodeOrEntry): keyNodeOrEntry is BinaryTreeNode<K, V>;
3055
3225
  ```
3056
3226
 
3057
- Defined in: [data-structures/binary-tree/binary-tree.ts:473](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L473)
3227
+ Defined in: [data-structures/binary-tree/binary-tree.ts:473](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L473)
3058
3228
 
3059
3229
  Checks if the given item is a "real" node (i.e., not null, undefined, or NIL).
3060
3230
 
@@ -3092,7 +3262,7 @@ Time O(1), Space O(1)
3092
3262
  isRealNodeOrNull(keyNodeOrEntry): keyNodeOrEntry is BinaryTreeNode<K, V> | null;
3093
3263
  ```
3094
3264
 
3095
- Defined in: [data-structures/binary-tree/binary-tree.ts:487](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L487)
3265
+ Defined in: [data-structures/binary-tree/binary-tree.ts:487](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L487)
3096
3266
 
3097
3267
  Checks if the given item is either a "real" node or null.
3098
3268
 
@@ -3130,7 +3300,7 @@ Time O(1), Space O(1)
3130
3300
  isValidKey(key): key is K;
3131
3301
  ```
3132
3302
 
3133
- Defined in: [data-structures/binary-tree/bst.ts:431](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L431)
3303
+ Defined in: [data-structures/binary-tree/bst.ts:436](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L436)
3134
3304
 
3135
3305
  Checks if the given key is valid (comparable).
3136
3306
 
@@ -3138,7 +3308,7 @@ Checks if the given key is valid (comparable).
3138
3308
 
3139
3309
  ##### key
3140
3310
 
3141
- `any`
3311
+ `unknown`
3142
3312
 
3143
3313
  The key to validate.
3144
3314
 
@@ -3164,7 +3334,7 @@ Time O(1)
3164
3334
  keys(): IterableIterator<K>;
3165
3335
  ```
3166
3336
 
3167
- Defined in: [data-structures/base/iterable-entry-base.ts:42](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/base/iterable-entry-base.ts#L42)
3337
+ Defined in: [data-structures/base/iterable-entry-base.ts:42](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L42)
3168
3338
 
3169
3339
  Iterate over keys only.
3170
3340
 
@@ -3220,7 +3390,7 @@ The traversal method.
3220
3390
  leaves(): (K | undefined)[];
3221
3391
  ```
3222
3392
 
3223
- Defined in: [data-structures/binary-tree/binary-tree.ts:2183](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L2183)
3393
+ Defined in: [data-structures/binary-tree/binary-tree.ts:2316](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2316)
3224
3394
 
3225
3395
  Get leaf nodes
3226
3396
 
@@ -3258,7 +3428,7 @@ leaves<C>(
3258
3428
  iterationType?): ReturnType<C>[];
3259
3429
  ```
3260
3430
 
3261
- Defined in: [data-structures/binary-tree/binary-tree.ts:2185](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L2185)
3431
+ Defined in: [data-structures/binary-tree/binary-tree.ts:2318](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2318)
3262
3432
 
3263
3433
  Get leaf nodes
3264
3434
 
@@ -3346,7 +3516,7 @@ The traversal method.
3346
3516
  lesserOrGreaterTraverse(): (K | undefined)[];
3347
3517
  ```
3348
3518
 
3349
- Defined in: [data-structures/binary-tree/bst.ts:1870](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L1870)
3519
+ Defined in: [data-structures/binary-tree/bst.ts:2244](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2244)
3350
3520
 
3351
3521
  ##### Returns
3352
3522
 
@@ -3362,7 +3532,7 @@ lesserOrGreaterTraverse<C>(
3362
3532
  iterationType?): ReturnType<C>[];
3363
3533
  ```
3364
3534
 
3365
- Defined in: [data-structures/binary-tree/bst.ts:1872](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L1872)
3535
+ Defined in: [data-structures/binary-tree/bst.ts:2246](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2246)
3366
3536
 
3367
3537
  ##### Type Parameters
3368
3538
 
@@ -3427,7 +3597,7 @@ The traversal method.
3427
3597
  listLevels(): (K | undefined)[][];
3428
3598
  ```
3429
3599
 
3430
- Defined in: [data-structures/binary-tree/bst.ts:674](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L674)
3600
+ Defined in: [data-structures/binary-tree/bst.ts:721](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L721)
3431
3601
 
3432
3602
  Level-order grouping
3433
3603
 
@@ -3468,7 +3638,7 @@ listLevels<C>(
3468
3638
  iterationType?): ReturnType<C>[][];
3469
3639
  ```
3470
3640
 
3471
- Defined in: [data-structures/binary-tree/bst.ts:676](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L676)
3641
+ Defined in: [data-structures/binary-tree/bst.ts:723](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L723)
3472
3642
 
3473
3643
  Level-order grouping
3474
3644
 
@@ -3533,7 +3703,7 @@ IBinaryTree.listLevels
3533
3703
  lower(keyNodeEntryOrPredicate): K | undefined;
3534
3704
  ```
3535
3705
 
3536
- Defined in: [data-structures/binary-tree/bst.ts:1767](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L1767)
3706
+ Defined in: [data-structures/binary-tree/bst.ts:2141](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2141)
3537
3707
 
3538
3708
  Returns the first key with a value < target.
3539
3709
  Equivalent to Java TreeMap.lower.
@@ -3575,7 +3745,7 @@ lower<C>(
3575
3745
  iterationType?): ReturnType<C>;
3576
3746
  ```
3577
3747
 
3578
- Defined in: [data-structures/binary-tree/bst.ts:1782](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L1782)
3748
+ Defined in: [data-structures/binary-tree/bst.ts:2156](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2156)
3579
3749
 
3580
3750
  Returns the first node with a key < target and applies callback.
3581
3751
  Time Complexity: O(log n) average, O(h) worst case.
@@ -3621,7 +3791,7 @@ map<MK, MV, MR>(
3621
3791
  thisArg?): BST<MK, MV, MR>;
3622
3792
  ```
3623
3793
 
3624
- Defined in: [data-structures/binary-tree/bst.ts:2145](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L2145)
3794
+ Defined in: [data-structures/binary-tree/bst.ts:2547](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2547)
3625
3795
 
3626
3796
  Creates a new BST by mapping each [key, value] pair to a new entry.
3627
3797
 
@@ -3705,7 +3875,7 @@ IBinaryTree.map
3705
3875
  merge(anotherTree): void;
3706
3876
  ```
3707
3877
 
3708
- Defined in: [data-structures/binary-tree/binary-tree.ts:867](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L867)
3878
+ Defined in: [data-structures/binary-tree/binary-tree.ts:902](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L902)
3709
3879
 
3710
3880
  Merges another tree into this one by seting all its nodes.
3711
3881
 
@@ -3779,7 +3949,7 @@ The node to start from.
3779
3949
  morris(): (K | undefined)[];
3780
3950
  ```
3781
3951
 
3782
- Defined in: [data-structures/binary-tree/binary-tree.ts:2387](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L2387)
3952
+ Defined in: [data-structures/binary-tree/binary-tree.ts:2534](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2534)
3783
3953
 
3784
3954
  Morris traversal (O(1) space)
3785
3955
 
@@ -3817,7 +3987,7 @@ morris<C>(
3817
3987
  startNode?): ReturnType<C>[];
3818
3988
  ```
3819
3989
 
3820
- Defined in: [data-structures/binary-tree/binary-tree.ts:2389](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L2389)
3990
+ Defined in: [data-structures/binary-tree/binary-tree.ts:2536](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2536)
3821
3991
 
3822
3992
  Morris traversal (O(1) space)
3823
3993
 
@@ -3877,7 +4047,7 @@ IBinaryTree.morris
3877
4047
  perfectlyBalance(iterationType?): boolean;
3878
4048
  ```
3879
4049
 
3880
- Defined in: [data-structures/binary-tree/bst.ts:1968](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L1968)
4050
+ Defined in: [data-structures/binary-tree/bst.ts:2349](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2349)
3881
4051
 
3882
4052
  Rebuilds the tree to be perfectly balanced.
3883
4053
 
@@ -3921,7 +4091,7 @@ Time O(N) (O(N) for DFS, O(N) for sorted build). Space O(N) for node array and r
3921
4091
  print(options?, startNode?): void;
3922
4092
  ```
3923
4093
 
3924
- Defined in: [data-structures/binary-tree/binary-tree.ts:2720](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L2720)
4094
+ Defined in: [data-structures/binary-tree/binary-tree.ts:2895](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2895)
3925
4095
 
3926
4096
  Prints a visual representation of the tree to the console.
3927
4097
 
@@ -3966,6 +4136,100 @@ Time O(N) (via `toVisual`). Space O(N*H) or O(N^2) (via `toVisual`).
3966
4136
 
3967
4137
  ***
3968
4138
 
4139
+ ### rangeByRank()
4140
+
4141
+ #### Call Signature
4142
+
4143
+ ```ts
4144
+ rangeByRank(start, end): (K | undefined)[];
4145
+ ```
4146
+
4147
+ Defined in: [data-structures/binary-tree/bst.ts:1332](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1332)
4148
+
4149
+ Returns elements by position range in tree order (0-indexed, inclusive on both ends).
4150
+
4151
+ ##### Parameters
4152
+
4153
+ ###### start
4154
+
4155
+ `number`
4156
+
4157
+ Start position (inclusive, 0-indexed). Clamped to 0 if negative.
4158
+
4159
+ ###### end
4160
+
4161
+ `number`
4162
+
4163
+ End position (inclusive, 0-indexed). Clamped to size-1 if too large.
4164
+
4165
+ ##### Returns
4166
+
4167
+ (`K` \| `undefined`)[]
4168
+
4169
+ Array of keys in tree order within the specified range.
4170
+
4171
+ ##### Remarks
4172
+
4173
+ Time O(log n + k), Space O(k), where k = end - start + 1. Requires `enableOrderStatistic: true`.
4174
+
4175
+ #### Call Signature
4176
+
4177
+ ```ts
4178
+ rangeByRank<C>(
4179
+ start,
4180
+ end,
4181
+ callback,
4182
+ iterationType?): ReturnType<C>[];
4183
+ ```
4184
+
4185
+ Defined in: [data-structures/binary-tree/bst.ts:1344](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1344)
4186
+
4187
+ Returns elements by position range in tree order with callback and optional iteration type.
4188
+
4189
+ ##### Type Parameters
4190
+
4191
+ ###### C
4192
+
4193
+ `C` *extends* `NodeCallback`\<[`BSTNode`](BSTNode.md)\<`K`, `V`\>\>
4194
+
4195
+ ##### Parameters
4196
+
4197
+ ###### start
4198
+
4199
+ `number`
4200
+
4201
+ Start rank (inclusive, 0-indexed).
4202
+
4203
+ ###### end
4204
+
4205
+ `number`
4206
+
4207
+ End rank (inclusive, 0-indexed).
4208
+
4209
+ ###### callback
4210
+
4211
+ `C`
4212
+
4213
+ Callback to apply to each node in the range.
4214
+
4215
+ ###### iterationType?
4216
+
4217
+ `IterationType`
4218
+
4219
+ Iteration strategy ('ITERATIVE' or 'RECURSIVE').
4220
+
4221
+ ##### Returns
4222
+
4223
+ `ReturnType`\<`C`\>[]
4224
+
4225
+ Array of callback results for nodes in the rank range.
4226
+
4227
+ ##### Remarks
4228
+
4229
+ Time O(log n + k), Space O(k), where k = end - start + 1. Requires `enableOrderStatistic: true`.
4230
+
4231
+ ***
4232
+
3969
4233
  ### rangeSearch()
3970
4234
 
3971
4235
  Performs an optimized search for nodes within a given key range.
@@ -4000,7 +4264,7 @@ The traversal method.
4000
4264
  rangeSearch(range): (K | undefined)[];
4001
4265
  ```
4002
4266
 
4003
- Defined in: [data-structures/binary-tree/bst.ts:1069](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L1069)
4267
+ Defined in: [data-structures/binary-tree/bst.ts:1151](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1151)
4004
4268
 
4005
4269
  Find all keys in a range
4006
4270
 
@@ -4034,7 +4298,7 @@ rangeSearch<C>(
4034
4298
  iterationType?): ReturnType<C>[];
4035
4299
  ```
4036
4300
 
4037
- Defined in: [data-structures/binary-tree/bst.ts:1071](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L1071)
4301
+ Defined in: [data-structures/binary-tree/bst.ts:1153](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1153)
4038
4302
 
4039
4303
  Find all keys in a range
4040
4304
 
@@ -4087,7 +4351,7 @@ Find all keys in a range
4087
4351
  reduce<U>(callbackfn, initialValue): U;
4088
4352
  ```
4089
4353
 
4090
- Defined in: [data-structures/base/iterable-entry-base.ts:171](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/base/iterable-entry-base.ts#L171)
4354
+ Defined in: [data-structures/base/iterable-entry-base.ts:171](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L171)
4091
4355
 
4092
4356
  Reduce entries into a single accumulator.
4093
4357
 
@@ -4139,7 +4403,7 @@ IBinaryTree.reduce
4139
4403
  refill(keysNodesEntriesOrRaws, values?): void;
4140
4404
  ```
4141
4405
 
4142
- Defined in: [data-structures/binary-tree/binary-tree.ts:878](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L878)
4406
+ Defined in: [data-structures/binary-tree/binary-tree.ts:913](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L913)
4143
4407
 
4144
4408
  Clears the tree and refills it with new items.
4145
4409
 
@@ -4223,7 +4487,7 @@ Whether to use 'RECURSIVE' or 'ITERATIVE' search.
4223
4487
  search(keyNodeEntryOrPredicate, onlyOne?): (K | undefined)[];
4224
4488
  ```
4225
4489
 
4226
- Defined in: [data-structures/binary-tree/bst.ts:882](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L882)
4490
+ Defined in: [data-structures/binary-tree/bst.ts:957](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L957)
4227
4491
 
4228
4492
  Search nodes by predicate
4229
4493
 
@@ -4279,7 +4543,7 @@ search<C>(
4279
4543
  iterationType?): ReturnType<C>[];
4280
4544
  ```
4281
4545
 
4282
- Defined in: [data-structures/binary-tree/bst.ts:894](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L894)
4546
+ Defined in: [data-structures/binary-tree/bst.ts:969](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L969)
4283
4547
 
4284
4548
  Search nodes by predicate
4285
4549
 
@@ -4353,7 +4617,7 @@ IBinaryTree.search
4353
4617
  set(keyNodeOrEntry, value?): boolean;
4354
4618
  ```
4355
4619
 
4356
- Defined in: [data-structures/binary-tree/bst.ts:1189](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L1189)
4620
+ Defined in: [data-structures/binary-tree/bst.ts:1518](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1518)
4357
4621
 
4358
4622
  Adds a new node to the BST based on key comparison.
4359
4623
 
@@ -4419,7 +4683,7 @@ setMany(
4419
4683
  iterationType?): boolean[];
4420
4684
  ```
4421
4685
 
4422
- Defined in: [data-structures/binary-tree/bst.ts:1297](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L1297)
4686
+ Defined in: [data-structures/binary-tree/bst.ts:1643](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1643)
4423
4687
 
4424
4688
  Adds multiple items to the tree.
4425
4689
 
@@ -4485,7 +4749,7 @@ Space O(N) for sorting and recursion/iteration stack.
4485
4749
  some(predicate, thisArg?): boolean;
4486
4750
  ```
4487
4751
 
4488
- Defined in: [data-structures/base/iterable-entry-base.ts:83](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/base/iterable-entry-base.ts#L83)
4752
+ Defined in: [data-structures/base/iterable-entry-base.ts:83](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L83)
4489
4753
 
4490
4754
  Test whether any entry satisfies the predicate.
4491
4755
 
@@ -4499,7 +4763,7 @@ Test whether any entry satisfies the predicate.
4499
4763
 
4500
4764
  ##### thisArg?
4501
4765
 
4502
- `any`
4766
+ `unknown`
4503
4767
 
4504
4768
  Optional `this` for callback.
4505
4769
 
@@ -4531,7 +4795,7 @@ IBinaryTree.some
4531
4795
  toArray(): [K, V | undefined][];
4532
4796
  ```
4533
4797
 
4534
- Defined in: [data-structures/base/iterable-entry-base.ts:186](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/base/iterable-entry-base.ts#L186)
4798
+ Defined in: [data-structures/base/iterable-entry-base.ts:186](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L186)
4535
4799
 
4536
4800
  Converts data structure to `[key, value]` pairs.
4537
4801
 
@@ -4557,7 +4821,7 @@ Time O(n), Space O(n)
4557
4821
  toVisual(startNode?, options?): string;
4558
4822
  ```
4559
4823
 
4560
- Defined in: [data-structures/binary-tree/binary-tree.ts:2657](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L2657)
4824
+ Defined in: [data-structures/binary-tree/binary-tree.ts:2825](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2825)
4561
4825
 
4562
4826
  Generates a string representation of the tree for visualization.
4563
4827
 
@@ -4600,7 +4864,7 @@ Time O(N), visits every node. Space O(N*H) or O(N^2) in the worst case, as the s
4600
4864
  values(): IterableIterator<V | undefined>;
4601
4865
  ```
4602
4866
 
4603
- Defined in: [data-structures/base/iterable-entry-base.ts:53](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/base/iterable-entry-base.ts#L53)
4867
+ Defined in: [data-structures/base/iterable-entry-base.ts:53](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L53)
4604
4868
 
4605
4869
  Iterate over values only.
4606
4870
 
@@ -4635,7 +4899,7 @@ IBinaryTree.values
4635
4899
  protected readonly _comparator: Comparator<K>;
4636
4900
  ```
4637
4901
 
4638
- Defined in: [data-structures/binary-tree/bst.ts:372](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L372)
4902
+ Defined in: [data-structures/binary-tree/bst.ts:377](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L377)
4639
4903
 
4640
4904
  The comparator function used to determine the order of keys in the tree.
4641
4905
 
@@ -4651,7 +4915,7 @@ Time O(1) Space O(1)
4651
4915
  protected readonly _DEFAULT_NODE_CALLBACK: NodeCallback<BinaryTreeNode<K, V> | null | undefined, K | undefined>;
4652
4916
  ```
4653
4917
 
4654
- Defined in: [data-structures/binary-tree/binary-tree.ts:2916](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L2916)
4918
+ Defined in: [data-structures/binary-tree/binary-tree.ts:3091](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3091)
4655
4919
 
4656
4920
  (Protected) Default callback function, returns the node's key.
4657
4921
 
@@ -4682,7 +4946,7 @@ protected _bound(
4682
4946
  iterationType): BSTNode<K, V> | undefined;
4683
4947
  ```
4684
4948
 
4685
- Defined in: [data-structures/binary-tree/bst.ts:2499](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L2499)
4949
+ Defined in: [data-structures/binary-tree/bst.ts:2899](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2899)
4686
4950
 
4687
4951
  (Protected) Core bound search implementation supporting all parameter types.
4688
4952
  Unified logic for both lowerBound and upperBound.
@@ -4730,7 +4994,7 @@ protected _boundByKey(
4730
4994
  iterationType): BSTNode<K, V> | undefined;
4731
4995
  ```
4732
4996
 
4733
- Defined in: [data-structures/binary-tree/bst.ts:2556](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L2556)
4997
+ Defined in: [data-structures/binary-tree/bst.ts:2956](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2956)
4734
4998
 
4735
4999
  (Protected) Binary search for bound by key with pruning optimization.
4736
5000
  Performs standard BST binary search, choosing left or right subtree based on comparator result.
@@ -4771,7 +5035,7 @@ The first node matching the bound condition, or undefined if none exists.
4771
5035
  protected _boundByPredicate(predicate, iterationType): BSTNode<K, V> | undefined;
4772
5036
  ```
4773
5037
 
4774
- Defined in: [data-structures/binary-tree/bst.ts:2611](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L2611)
5038
+ Defined in: [data-structures/binary-tree/bst.ts:3011](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3011)
4775
5039
 
4776
5040
  (Protected) In-order traversal search by predicate.
4777
5041
  Falls back to linear in-order traversal when predicate-based search is required.
@@ -4807,7 +5071,7 @@ The first node satisfying predicate, or undefined if none found.
4807
5071
  protected _clearNodes(): void;
4808
5072
  ```
4809
5073
 
4810
- Defined in: [data-structures/binary-tree/binary-tree.ts:3350](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L3350)
5074
+ Defined in: [data-structures/binary-tree/binary-tree.ts:3525](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3525)
4811
5075
 
4812
5076
  (Protected) Clears all nodes from the tree.
4813
5077
 
@@ -4831,7 +5095,7 @@ Time O(1)
4831
5095
  protected _clearValues(): void;
4832
5096
  ```
4833
5097
 
4834
- Defined in: [data-structures/binary-tree/binary-tree.ts:3359](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L3359)
5098
+ Defined in: [data-structures/binary-tree/binary-tree.ts:3534](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3534)
4835
5099
 
4836
5100
  (Protected) Clears all values from the external store.
4837
5101
 
@@ -4855,7 +5119,7 @@ Time O(N)
4855
5119
  protected _clone(cloned): void;
4856
5120
  ```
4857
5121
 
4858
- Defined in: [data-structures/binary-tree/binary-tree.ts:3009](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L3009)
5122
+ Defined in: [data-structures/binary-tree/binary-tree.ts:3184](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3184)
4859
5123
 
4860
5124
  (Protected) Helper for cloning. Performs a BFS and sets all nodes to the new tree.
4861
5125
 
@@ -4887,7 +5151,7 @@ Time O(N * M) (O(N) BFS + O(M) `set` for each node).
4887
5151
  protected _compare(a, b): number;
4888
5152
  ```
4889
5153
 
4890
- Defined in: [data-structures/binary-tree/bst.ts:2751](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L2751)
5154
+ Defined in: [data-structures/binary-tree/bst.ts:3275](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3275)
4891
5155
 
4892
5156
  (Protected) Compares two keys using the tree's comparator and reverse setting.
4893
5157
 
@@ -4923,7 +5187,7 @@ Time O(1) Space O(1)
4923
5187
  protected _createDefaultComparator(): Comparator<K>;
4924
5188
  ```
4925
5189
 
4926
- Defined in: [data-structures/binary-tree/bst.ts:2224](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L2224)
5190
+ Defined in: [data-structures/binary-tree/bst.ts:2626](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2626)
4927
5191
 
4928
5192
  (Protected) Creates the default comparator function for keys that don't have a custom comparator.
4929
5193
 
@@ -4945,7 +5209,7 @@ Time O(1) Space O(1)
4945
5209
  protected _createInstance<TK, TV, TR>(options?): this;
4946
5210
  ```
4947
5211
 
4948
- Defined in: [data-structures/binary-tree/bst.ts:2673](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L2673)
5212
+ Defined in: [data-structures/binary-tree/bst.ts:3073](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3073)
4949
5213
 
4950
5214
  (Protected) Creates a new, empty instance of the same BST constructor.
4951
5215
 
@@ -4993,7 +5257,7 @@ Time O(1)
4993
5257
  protected _createLike<TK, TV, TR>(iter?, options?): BST<TK, TV, TR>;
4994
5258
  ```
4995
5259
 
4996
- Defined in: [data-structures/binary-tree/bst.ts:2690](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L2690)
5260
+ Defined in: [data-structures/binary-tree/bst.ts:3090](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3090)
4997
5261
 
4998
5262
  (Protected) Creates a new instance of the same BST constructor, potentially with different generic types.
4999
5263
 
@@ -5053,7 +5317,7 @@ Time O(N log N) or O(N^2) (from constructor) due to processing the iterable.
5053
5317
  protected _deleteByKey(key): boolean;
5054
5318
  ```
5055
5319
 
5056
- Defined in: [data-structures/binary-tree/bst.ts:2762](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L2762)
5320
+ Defined in: [data-structures/binary-tree/bst.ts:3286](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3286)
5057
5321
 
5058
5322
  (Private) Deletes a node by its key.
5059
5323
 
@@ -5093,7 +5357,7 @@ protected _dfs<C>(
5093
5357
  shouldProcessRoot?): ReturnType<C>[];
5094
5358
  ```
5095
5359
 
5096
- Defined in: [data-structures/binary-tree/binary-tree.ts:2727](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L2727)
5360
+ Defined in: [data-structures/binary-tree/binary-tree.ts:2902](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2902)
5097
5361
 
5098
5362
  #### Type Parameters
5099
5363
 
@@ -5186,7 +5450,7 @@ Array of callback results.
5186
5450
  protected _displayAux(node, options): NodeDisplayLayout;
5187
5451
  ```
5188
5452
 
5189
- Defined in: [data-structures/binary-tree/binary-tree.ts:3033](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L3033)
5453
+ Defined in: [data-structures/binary-tree/binary-tree.ts:3208](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3208)
5190
5454
 
5191
5455
  (Protected) Recursive helper for `toVisual`.
5192
5456
 
@@ -5226,7 +5490,7 @@ Time O(N), Space O(N*H) or O(N^2)
5226
5490
  protected _ensurePredicate(keyNodeEntryOrPredicate): NodePredicate<BinaryTreeNode<K, V>>;
5227
5491
  ```
5228
5492
 
5229
- Defined in: [data-structures/binary-tree/binary-tree.ts:3256](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L3256)
5493
+ Defined in: [data-structures/binary-tree/binary-tree.ts:3431](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3431)
5230
5494
 
5231
5495
  (Protected) Converts a key, node, entry, or predicate into a standardized predicate function.
5232
5496
 
@@ -5265,7 +5529,7 @@ Time O(1)
5265
5529
  protected _extractKey(keyNodeOrEntry): K | null | undefined;
5266
5530
  ```
5267
5531
 
5268
- Defined in: [data-structures/binary-tree/binary-tree.ts:3316](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L3316)
5532
+ Defined in: [data-structures/binary-tree/binary-tree.ts:3491](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3491)
5269
5533
 
5270
5534
  (Protected) Extracts the key from a key, node, or entry.
5271
5535
 
@@ -5303,7 +5567,7 @@ Time O(1)
5303
5567
  protected _floorByKey(key, iterationType): BSTNode<K, V> | undefined;
5304
5568
  ```
5305
5569
 
5306
- Defined in: [data-structures/binary-tree/bst.ts:2264](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L2264)
5570
+ Defined in: [data-structures/binary-tree/bst.ts:2664](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2664)
5307
5571
 
5308
5572
  (Protected) Binary search for floor by key with pruning optimization.
5309
5573
  Performs standard BST binary search, choosing left or right subtree based on comparator result.
@@ -5341,7 +5605,7 @@ Time O(h) where h is tree height.
5341
5605
  protected _floorByPredicate(predicate, iterationType): BSTNode<K, V> | undefined;
5342
5606
  ```
5343
5607
 
5344
- Defined in: [data-structures/binary-tree/bst.ts:2317](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L2317)
5608
+ Defined in: [data-structures/binary-tree/bst.ts:2717](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2717)
5345
5609
 
5346
5610
  (Protected) In-order traversal search for floor by predicate.
5347
5611
  Falls back to linear in-order traversal when predicate-based search is required.
@@ -5374,13 +5638,73 @@ Space Complexity: O(h) for recursion, O(h) for iterative stack.
5374
5638
 
5375
5639
  ***
5376
5640
 
5641
+ ### \_getByRankIterative()
5642
+
5643
+ ```ts
5644
+ protected _getByRankIterative(node, k): BSTNode<K, V> | undefined;
5645
+ ```
5646
+
5647
+ Defined in: [data-structures/binary-tree/bst.ts:3167](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3167)
5648
+
5649
+ (Protected) Finds the node at position k in tree order (iterative).
5650
+
5651
+ #### Parameters
5652
+
5653
+ ##### node
5654
+
5655
+ `OptNode`\<[`BSTNode`](BSTNode.md)\<`K`, `V`\>\>
5656
+
5657
+ ##### k
5658
+
5659
+ `number`
5660
+
5661
+ #### Returns
5662
+
5663
+ [`BSTNode`](BSTNode.md)\<`K`, `V`\> \| `undefined`
5664
+
5665
+ #### Remarks
5666
+
5667
+ Time O(log n), Space O(1)
5668
+
5669
+ ***
5670
+
5671
+ ### \_getByRankRecursive()
5672
+
5673
+ ```ts
5674
+ protected _getByRankRecursive(node, k): BSTNode<K, V> | undefined;
5675
+ ```
5676
+
5677
+ Defined in: [data-structures/binary-tree/bst.ts:3188](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3188)
5678
+
5679
+ (Protected) Finds the node at position k in tree order (recursive).
5680
+
5681
+ #### Parameters
5682
+
5683
+ ##### node
5684
+
5685
+ `OptNode`\<[`BSTNode`](BSTNode.md)\<`K`, `V`\>\>
5686
+
5687
+ ##### k
5688
+
5689
+ `number`
5690
+
5691
+ #### Returns
5692
+
5693
+ [`BSTNode`](BSTNode.md)\<`K`, `V`\> \| `undefined`
5694
+
5695
+ #### Remarks
5696
+
5697
+ Time O(log n), Space O(log n) call stack
5698
+
5699
+ ***
5700
+
5377
5701
  ### \_getIterator()
5378
5702
 
5379
5703
  ```ts
5380
5704
  protected _getIterator(node?): IterableIterator<[K, V | undefined]>;
5381
5705
  ```
5382
5706
 
5383
- Defined in: [data-structures/binary-tree/binary-tree.ts:2872](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L2872)
5707
+ Defined in: [data-structures/binary-tree/binary-tree.ts:3047](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3047)
5384
5708
 
5385
5709
  (Protected) Gets the iterator for the tree (default in-order).
5386
5710
 
@@ -5408,13 +5732,73 @@ Time O(N) for full iteration. O(H) to get the first element. Space O(H) for the
5408
5732
 
5409
5733
  ***
5410
5734
 
5735
+ ### \_getRankIterative()
5736
+
5737
+ ```ts
5738
+ protected _getRankIterative(node, key): number;
5739
+ ```
5740
+
5741
+ Defined in: [data-structures/binary-tree/bst.ts:3200](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3200)
5742
+
5743
+ (Protected) Computes the rank of a key iteratively.
5744
+
5745
+ #### Parameters
5746
+
5747
+ ##### node
5748
+
5749
+ `OptNode`\<[`BSTNode`](BSTNode.md)\<`K`, `V`\>\>
5750
+
5751
+ ##### key
5752
+
5753
+ `K`
5754
+
5755
+ #### Returns
5756
+
5757
+ `number`
5758
+
5759
+ #### Remarks
5760
+
5761
+ Time O(log n), Space O(1)
5762
+
5763
+ ***
5764
+
5765
+ ### \_getRankRecursive()
5766
+
5767
+ ```ts
5768
+ protected _getRankRecursive(node, key): number;
5769
+ ```
5770
+
5771
+ Defined in: [data-structures/binary-tree/bst.ts:3226](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3226)
5772
+
5773
+ (Protected) Computes the rank of a key recursively.
5774
+
5775
+ #### Parameters
5776
+
5777
+ ##### node
5778
+
5779
+ `OptNode`\<[`BSTNode`](BSTNode.md)\<`K`, `V`\>\>
5780
+
5781
+ ##### key
5782
+
5783
+ `K`
5784
+
5785
+ #### Returns
5786
+
5787
+ `number`
5788
+
5789
+ #### Remarks
5790
+
5791
+ Time O(log n), Space O(log n) call stack
5792
+
5793
+ ***
5794
+
5411
5795
  ### \_isDisplayLeaf()
5412
5796
 
5413
5797
  ```ts
5414
5798
  protected _isDisplayLeaf(node, options): boolean;
5415
5799
  ```
5416
5800
 
5417
- Defined in: [data-structures/binary-tree/binary-tree.ts:3128](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L3128)
5801
+ Defined in: [data-structures/binary-tree/binary-tree.ts:3303](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3303)
5418
5802
 
5419
5803
  Check if a node is a display leaf (empty, null, undefined, NIL, or real leaf).
5420
5804
 
@@ -5444,7 +5828,7 @@ Check if a node is a display leaf (empty, null, undefined, NIL, or real leaf).
5444
5828
  protected _isPredicate(p): p is NodePredicate<BinaryTreeNode<K, V>>;
5445
5829
  ```
5446
5830
 
5447
- Defined in: [data-structures/binary-tree/binary-tree.ts:3305](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L3305)
5831
+ Defined in: [data-structures/binary-tree/binary-tree.ts:3480](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3480)
5448
5832
 
5449
5833
  (Protected) Checks if an item is a predicate function.
5450
5834
 
@@ -5452,7 +5836,7 @@ Defined in: [data-structures/binary-tree/binary-tree.ts:3305](https://github.com
5452
5836
 
5453
5837
  ##### p
5454
5838
 
5455
- `any`
5839
+ `unknown`
5456
5840
 
5457
5841
  The item to check.
5458
5842
 
@@ -5478,7 +5862,7 @@ Time O(1)
5478
5862
  protected _keyValueNodeOrEntryToNodeAndValue(keyNodeOrEntry, value?): [OptNode<BSTNode<K, V>>, V | undefined];
5479
5863
  ```
5480
5864
 
5481
- Defined in: [data-structures/binary-tree/bst.ts:2723](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L2723)
5865
+ Defined in: [data-structures/binary-tree/bst.ts:3124](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3124)
5482
5866
 
5483
5867
  (Protected) Converts a key, node, or entry into a standardized [node, value] tuple.
5484
5868
 
@@ -5522,7 +5906,7 @@ Time O(1)
5522
5906
  protected _lowerByKey(key, iterationType): BSTNode<K, V> | undefined;
5523
5907
  ```
5524
5908
 
5525
- Defined in: [data-structures/binary-tree/bst.ts:2382](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L2382)
5909
+ Defined in: [data-structures/binary-tree/bst.ts:2782](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2782)
5526
5910
 
5527
5911
  (Protected) Binary search for lower by key with pruning optimization.
5528
5912
  Performs standard BST binary search, choosing left or right subtree based on comparator result.
@@ -5560,7 +5944,7 @@ Time O(h) where h is tree height.
5560
5944
  protected _lowerByPredicate(predicate, iterationType): BSTNode<K, V> | undefined;
5561
5945
  ```
5562
5946
 
5563
- Defined in: [data-structures/binary-tree/bst.ts:2435](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L2435)
5947
+ Defined in: [data-structures/binary-tree/bst.ts:2835](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2835)
5564
5948
 
5565
5949
  (Protected) In-order traversal search for lower by predicate.
5566
5950
  Falls back to linear in-order traversal when predicate-based search is required.
@@ -5593,13 +5977,39 @@ Space Complexity: O(h) for recursion, O(h) for iterative stack.
5593
5977
 
5594
5978
  ***
5595
5979
 
5980
+ ### \_next()
5981
+
5982
+ ```ts
5983
+ protected _next(node): BSTNode<K, V> | undefined;
5984
+ ```
5985
+
5986
+ Defined in: [data-structures/binary-tree/bst.ts:3243](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3243)
5987
+
5988
+ (Protected) Finds the in-order successor of a node.
5989
+
5990
+ #### Parameters
5991
+
5992
+ ##### node
5993
+
5994
+ [`BSTNode`](BSTNode.md)\<`K`, `V`\>
5995
+
5996
+ #### Returns
5997
+
5998
+ [`BSTNode`](BSTNode.md)\<`K`, `V`\> \| `undefined`
5999
+
6000
+ #### Remarks
6001
+
6002
+ Time O(log n), Space O(1)
6003
+
6004
+ ***
6005
+
5596
6006
  ### \_replaceNode()
5597
6007
 
5598
6008
  ```ts
5599
6009
  protected _replaceNode(oldNode, newNode): BinaryTreeNode<K, V>;
5600
6010
  ```
5601
6011
 
5602
- Defined in: [data-structures/binary-tree/binary-tree.ts:3218](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L3218)
6012
+ Defined in: [data-structures/binary-tree/binary-tree.ts:3393](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3393)
5603
6013
 
5604
6014
  (Protected) Replaces a node in the tree with a new node, maintaining children and parent links.
5605
6015
 
@@ -5642,7 +6052,7 @@ protected _resolveDisplayLeaf(
5642
6052
  emptyDisplayLayout): NodeDisplayLayout;
5643
6053
  ```
5644
6054
 
5645
- Defined in: [data-structures/binary-tree/binary-tree.ts:3158](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L3158)
6055
+ Defined in: [data-structures/binary-tree/binary-tree.ts:3333](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3333)
5646
6056
 
5647
6057
  Resolve a display leaf node to its layout.
5648
6058
 
@@ -5676,7 +6086,7 @@ Resolve a display leaf node to its layout.
5676
6086
  protected _setRoot(v): void;
5677
6087
  ```
5678
6088
 
5679
- Defined in: [data-structures/binary-tree/bst.ts:2738](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L2738)
6089
+ Defined in: [data-structures/binary-tree/bst.ts:3262](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3262)
5680
6090
 
5681
6091
  (Protected) Sets the root node and clears its parent reference.
5682
6092
 
@@ -5708,7 +6118,7 @@ Time O(1)
5708
6118
  protected _setValue(key, value): boolean;
5709
6119
  ```
5710
6120
 
5711
- Defined in: [data-structures/binary-tree/binary-tree.ts:3337](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L3337)
6121
+ Defined in: [data-structures/binary-tree/binary-tree.ts:3512](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3512)
5712
6122
 
5713
6123
  (Protected) Sets a value in the external store (Map mode).
5714
6124
 
@@ -5748,7 +6158,7 @@ Time O(1) (average for Map.set).
5748
6158
  protected _snapshotOptions<TK, TV, TR>(): BSTOptions<TK, TV, TR>;
5749
6159
  ```
5750
6160
 
5751
- Defined in: [data-structures/binary-tree/bst.ts:2708](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L2708)
6161
+ Defined in: [data-structures/binary-tree/bst.ts:3108](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3108)
5752
6162
 
5753
6163
  (Protected) Snapshots the current BST's configuration options.
5754
6164
 
@@ -5788,7 +6198,7 @@ Time O(1)
5788
6198
  protected _swapProperties(srcNode, destNode): BinaryTreeNode<K, V> | undefined;
5789
6199
  ```
5790
6200
 
5791
- Defined in: [data-structures/binary-tree/binary-tree.ts:3184](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L3184)
6201
+ Defined in: [data-structures/binary-tree/binary-tree.ts:3359](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3359)
5792
6202
 
5793
6203
  (Protected) Swaps the key/value properties of two nodes.
5794
6204
 
@@ -5829,3 +6239,55 @@ Time O(1)
5829
6239
  [`BinaryTree`](BinaryTree.md).[`_swapProperties`](BinaryTree.md#_swapproperties)
5830
6240
 
5831
6241
  ***
6242
+
6243
+ ### \_updateCount()
6244
+
6245
+ ```ts
6246
+ protected _updateCount(node): void;
6247
+ ```
6248
+
6249
+ Defined in: [data-structures/binary-tree/bst.ts:3143](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3143)
6250
+
6251
+ (Protected) Recalculates the subtree count for a single node.
6252
+
6253
+ #### Parameters
6254
+
6255
+ ##### node
6256
+
6257
+ [`BSTNode`](BSTNode.md)\<`K`, `V`\>
6258
+
6259
+ #### Returns
6260
+
6261
+ `void`
6262
+
6263
+ #### Remarks
6264
+
6265
+ Time O(1). Only active when enableOrderStatistic is true.
6266
+
6267
+ ***
6268
+
6269
+ ### \_updateCountAlongPath()
6270
+
6271
+ ```ts
6272
+ protected _updateCountAlongPath(node): void;
6273
+ ```
6274
+
6275
+ Defined in: [data-structures/binary-tree/bst.ts:3154](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3154)
6276
+
6277
+ (Protected) Updates subtree counts from a node up to the root.
6278
+
6279
+ #### Parameters
6280
+
6281
+ ##### node
6282
+
6283
+ `OptNode`\<[`BSTNode`](BSTNode.md)\<`K`, `V`\>\>
6284
+
6285
+ #### Returns
6286
+
6287
+ `void`
6288
+
6289
+ #### Remarks
6290
+
6291
+ Time O(log n). Only active when enableOrderStatistic is true.
6292
+
6293
+ ***