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: AVLTree\<K, V, R\>
8
8
 
9
- Defined in: [data-structures/binary-tree/avl-tree.ts:312](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/avl-tree.ts#L312)
9
+ Defined in: [data-structures/binary-tree/avl-tree.ts:312](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/avl-tree.ts#L312)
10
10
 
11
11
  Represents a self-balancing AVL (Adelson-Velsky and Landis) Tree.
12
12
  This tree extends BST and performs rotations on set/delete to maintain balance.
@@ -182,7 +182,7 @@ The type of the raw data object (if using `toEntryFn`).
182
182
  new AVLTree<K, V, R>(keysNodesEntriesOrRaws?, options?): AVLTree<K, V, R>;
183
183
  ```
184
184
 
185
- Defined in: [data-structures/binary-tree/avl-tree.ts:320](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/avl-tree.ts#L320)
185
+ Defined in: [data-structures/binary-tree/avl-tree.ts:320](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/avl-tree.ts#L320)
186
186
 
187
187
  Creates an instance of AVLTree.
188
188
 
@@ -228,7 +228,7 @@ Time O(N log N) (from `setMany` with balanced set). Space O(N).
228
228
  get comparator(): Comparator<K>;
229
229
  ```
230
230
 
231
- 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)
231
+ 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)
232
232
 
233
233
  Gets the comparator function used by the tree.
234
234
 
@@ -256,7 +256,7 @@ The comparator function.
256
256
  get isDuplicate(): boolean;
257
257
  ```
258
258
 
259
- 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)
259
+ 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)
260
260
 
261
261
  Gets whether the tree allows duplicate keys.
262
262
 
@@ -290,7 +290,7 @@ IBinaryTree.isDuplicate
290
290
  get isMapMode(): boolean;
291
291
  ```
292
292
 
293
- 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)
293
+ 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)
294
294
 
295
295
  Gets whether the tree is in Map mode.
296
296
 
@@ -324,7 +324,7 @@ IBinaryTree.isMapMode
324
324
  get NIL(): BinaryTreeNode<K, V>;
325
325
  ```
326
326
 
327
- 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)
327
+ 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)
328
328
 
329
329
  Gets the sentinel NIL node (used in self-balancing trees like Red-Black Tree).
330
330
 
@@ -358,7 +358,7 @@ IBinaryTree.NIL
358
358
  get root(): OptNode<BSTNode<K, V>>;
359
359
  ```
360
360
 
361
- 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)
361
+ 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)
362
362
 
363
363
  Gets the root node of the tree.
364
364
 
@@ -392,7 +392,7 @@ IBinaryTree.root
392
392
  get size(): number;
393
393
  ```
394
394
 
395
- 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)
395
+ 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)
396
396
 
397
397
  Gets the number of nodes in the tree.
398
398
 
@@ -426,7 +426,7 @@ IBinaryTree.size
426
426
  get store(): Map<K, BinaryTreeNode<K, V>>;
427
427
  ```
428
428
 
429
- 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)
429
+ 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)
430
430
 
431
431
  Gets the external value store (used in Map mode).
432
432
 
@@ -460,7 +460,7 @@ IBinaryTree.store
460
460
  get toEntryFn(): ToEntryFn<K, V, R> | undefined;
461
461
  ```
462
462
 
463
- 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)
463
+ 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)
464
464
 
465
465
  Gets the function used to convert raw data objects (R) into [key, value] entries.
466
466
 
@@ -492,7 +492,7 @@ IBinaryTree.toEntryFn
492
492
  iterator: IterableIterator<[K, V | undefined]>;
493
493
  ```
494
494
 
495
- 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)
495
+ 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)
496
496
 
497
497
  Default iterator yielding `[key, value]` entries.
498
498
 
@@ -500,7 +500,7 @@ Default iterator yielding `[key, value]` entries.
500
500
 
501
501
  ##### args
502
502
 
503
- ...`any`[]
503
+ ...`unknown`[]
504
504
 
505
505
  #### Returns
506
506
 
@@ -530,7 +530,7 @@ IBinaryTree.[iterator]
530
530
  add(keyNodeOrEntry): boolean;
531
531
  ```
532
532
 
533
- Defined in: [data-structures/binary-tree/binary-tree.ts:601](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L601)
533
+ 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)
534
534
 
535
535
  Adds a new node to the tree.
536
536
 
@@ -588,7 +588,7 @@ IBinaryTree.add
588
588
  addMany(keysNodesEntriesOrRaws): boolean[];
589
589
  ```
590
590
 
591
- Defined in: [data-structures/binary-tree/binary-tree.ts:760](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L760)
591
+ 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)
592
592
 
593
593
  Adds multiple items to the tree.
594
594
 
@@ -669,7 +669,7 @@ The traversal method.
669
669
  bfs(): (K | undefined)[];
670
670
  ```
671
671
 
672
- Defined in: [data-structures/binary-tree/bst.ts:587](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L587)
672
+ 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)
673
673
 
674
674
  BinaryTree level-order traversal
675
675
 
@@ -707,7 +707,7 @@ bfs<C>(
707
707
  iterationType?): ReturnType<C>[];
708
708
  ```
709
709
 
710
- Defined in: [data-structures/binary-tree/bst.ts:588](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L588)
710
+ 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)
711
711
 
712
712
  BinaryTree level-order traversal
713
713
 
@@ -769,7 +769,7 @@ IBinaryTree.bfs
769
769
  ceiling(keyNodeEntryOrPredicate): K | undefined;
770
770
  ```
771
771
 
772
- Defined in: [data-structures/binary-tree/bst.ts:1429](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L1429)
772
+ 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)
773
773
 
774
774
  Returns the first key with a value >= target.
775
775
  Equivalent to Java TreeMap.ceiling.
@@ -816,7 +816,7 @@ ceiling<C>(
816
816
  iterationType?): ReturnType<C>;
817
817
  ```
818
818
 
819
- Defined in: [data-structures/binary-tree/bst.ts:1444](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L1444)
819
+ 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)
820
820
 
821
821
  Returns the first node with a key >= target and applies callback.
822
822
  Time Complexity: O(log n) average, O(h) worst case.
@@ -863,7 +863,7 @@ Space Complexity: O(h) for recursion, O(1) for iteration.
863
863
  clear(): void;
864
864
  ```
865
865
 
866
- Defined in: [data-structures/binary-tree/binary-tree.ts:1425](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L1425)
866
+ 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)
867
867
 
868
868
  Clears the tree of all nodes and values.
869
869
 
@@ -904,7 +904,7 @@ IBinaryTree.clear
904
904
  clone(): this;
905
905
  ```
906
906
 
907
- Defined in: [data-structures/binary-tree/binary-tree.ts:2543](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L2543)
907
+ 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)
908
908
 
909
909
  Clones the tree.
910
910
 
@@ -948,7 +948,7 @@ IBinaryTree.clone
948
948
  createNode(key, value?): AVLTreeNode<K, V>;
949
949
  ```
950
950
 
951
- Defined in: [data-structures/binary-tree/avl-tree.ts:339](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/avl-tree.ts#L339)
951
+ Defined in: [data-structures/binary-tree/avl-tree.ts:339](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/avl-tree.ts#L339)
952
952
 
953
953
  (Protected) Creates a new AVL tree node.
954
954
 
@@ -994,7 +994,7 @@ IBinaryTree.createNode
994
994
  createTree(options?): this;
995
995
  ```
996
996
 
997
- 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)
997
+ 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)
998
998
 
999
999
  Creates a new, empty tree of the same type and configuration.
1000
1000
 
@@ -1034,7 +1034,7 @@ IBinaryTree.createTree
1034
1034
  delete(keyNodeOrEntry): BinaryTreeDeleteResult<AVLTreeNode<K, V>>[];
1035
1035
  ```
1036
1036
 
1037
- Defined in: [data-structures/binary-tree/avl-tree.ts:582](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/avl-tree.ts#L582)
1037
+ Defined in: [data-structures/binary-tree/avl-tree.ts:631](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/avl-tree.ts#L631)
1038
1038
 
1039
1039
  Deletes a node from the AVL tree and re-balances the tree.
1040
1040
 
@@ -1094,7 +1094,7 @@ deleteWhere(
1094
1094
  iterationType?): BinaryTreeDeleteResult<BSTNode<K, V>>[];
1095
1095
  ```
1096
1096
 
1097
- 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)
1097
+ 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)
1098
1098
 
1099
1099
  Deletes nodes that match a key, node, entry, predicate, or range.
1100
1100
 
@@ -1205,7 +1205,7 @@ The traversal method.
1205
1205
  dfs(): (K | undefined)[];
1206
1206
  ```
1207
1207
 
1208
- Defined in: [data-structures/binary-tree/bst.ts:499](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L499)
1208
+ 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)
1209
1209
 
1210
1210
  Depth-first search traversal
1211
1211
 
@@ -1245,7 +1245,7 @@ dfs<C>(
1245
1245
  iterationType?): ReturnType<C>[];
1246
1246
  ```
1247
1247
 
1248
- Defined in: [data-structures/binary-tree/bst.ts:501](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L501)
1248
+ 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)
1249
1249
 
1250
1250
  Depth-first search traversal
1251
1251
 
@@ -1313,7 +1313,7 @@ IBinaryTree.dfs
1313
1313
  ensureNode(keyNodeOrEntry, iterationType?): OptNode<BSTNode<K, V>>;
1314
1314
  ```
1315
1315
 
1316
- 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)
1316
+ 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)
1317
1317
 
1318
1318
  Ensures the input is a node. If it's a key or entry, it searches for the node.
1319
1319
 
@@ -1357,7 +1357,7 @@ Time O(log N) (height of the tree), O(N) worst-case.
1357
1357
  entries(): IterableIterator<[K, V | undefined]>;
1358
1358
  ```
1359
1359
 
1360
- 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)
1360
+ 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)
1361
1361
 
1362
1362
  Iterate over `[key, value]` pairs (may yield `undefined` values).
1363
1363
 
@@ -1389,7 +1389,7 @@ IBinaryTree.entries
1389
1389
  every(predicate, thisArg?): boolean;
1390
1390
  ```
1391
1391
 
1392
- 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)
1392
+ 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)
1393
1393
 
1394
1394
  Test whether all entries satisfy the predicate.
1395
1395
 
@@ -1403,7 +1403,7 @@ Test whether all entries satisfy the predicate.
1403
1403
 
1404
1404
  ##### thisArg?
1405
1405
 
1406
- `any`
1406
+ `unknown`
1407
1407
 
1408
1408
  Optional `this` for callback.
1409
1409
 
@@ -1435,7 +1435,7 @@ IBinaryTree.every
1435
1435
  filter(predicate, thisArg?): this;
1436
1436
  ```
1437
1437
 
1438
- Defined in: [data-structures/binary-tree/binary-tree.ts:2588](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/binary-tree.ts#L2588)
1438
+ 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)
1439
1439
 
1440
1440
  Creates a new tree containing only the entries that satisfy the predicate.
1441
1441
 
@@ -1492,7 +1492,7 @@ IBinaryTree.filter
1492
1492
  find(callbackfn, thisArg?): [K, V | undefined] | undefined;
1493
1493
  ```
1494
1494
 
1495
- 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)
1495
+ 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)
1496
1496
 
1497
1497
  Find the first entry that matches a predicate.
1498
1498
 
@@ -1506,7 +1506,7 @@ Find the first entry that matches a predicate.
1506
1506
 
1507
1507
  ##### thisArg?
1508
1508
 
1509
- `any`
1509
+ `unknown`
1510
1510
 
1511
1511
  Optional `this` for callback.
1512
1512
 
@@ -1540,7 +1540,7 @@ IBinaryTree.find
1540
1540
  floor(keyNodeEntryOrPredicate): K | undefined;
1541
1541
  ```
1542
1542
 
1543
- Defined in: [data-structures/binary-tree/bst.ts:1626](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L1626)
1543
+ 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)
1544
1544
 
1545
1545
  Returns the first key with a value <= target.
1546
1546
  Equivalent to Java TreeMap.floor.
@@ -1587,7 +1587,7 @@ floor<C>(
1587
1587
  iterationType?): ReturnType<C>;
1588
1588
  ```
1589
1589
 
1590
- Defined in: [data-structures/binary-tree/bst.ts:1641](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/bst.ts#L1641)
1590
+ 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)
1591
1591
 
1592
1592
  Returns the first node with a key <= target and applies callback.
1593
1593
  Time Complexity: O(log n) average, O(h) worst case.
@@ -1634,7 +1634,7 @@ Space Complexity: O(h) for recursion, O(1) for iteration.
1634
1634
  forEach(callbackfn, thisArg?): void;
1635
1635
  ```
1636
1636
 
1637
- 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)
1637
+ 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)
1638
1638
 
1639
1639
  Visit each entry, left-to-right.
1640
1640
 
@@ -1648,7 +1648,7 @@ Visit each entry, left-to-right.
1648
1648
 
1649
1649
  ##### thisArg?
1650
1650
 
1651
- `any`
1651
+ `unknown`
1652
1652
 
1653
1653
  Optional `this` for callback.
1654
1654
 
@@ -1681,7 +1681,7 @@ get(
1681
1681
  iterationType?): V | undefined;
1682
1682
  ```
1683
1683
 
1684
- 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)
1684
+ 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)
1685
1685
 
1686
1686
  Gets the value associated with a key.
1687
1687
 
@@ -1745,13 +1745,114 @@ IBinaryTree.get
1745
1745
 
1746
1746
  ***
1747
1747
 
1748
+ ### getByRank()
1749
+
1750
+ #### Call Signature
1751
+
1752
+ ```ts
1753
+ getByRank(k): K | undefined;
1754
+ ```
1755
+
1756
+ 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)
1757
+
1758
+ Returns the element at the k-th position in tree order (0-indexed).
1759
+
1760
+ ##### Parameters
1761
+
1762
+ ###### k
1763
+
1764
+ `number`
1765
+
1766
+ The 0-based position in tree order (0 = first element).
1767
+
1768
+ ##### Returns
1769
+
1770
+ `K` \| `undefined`
1771
+
1772
+ The key at position k, or `undefined` if out of bounds.
1773
+ *
1774
+
1775
+ ##### Remarks
1776
+
1777
+ Time O(log n), Space O(1) iterative / O(log n) recursive. Requires `enableOrderStatistic: true`.
1778
+ Tree order is defined by the comparator — ascending by default, but respects custom comparators (e.g. descending).
1779
+
1780
+ ##### Example
1781
+
1782
+ ```ts
1783
+ // Order-statistic on BST
1784
+ const tree = new BST<number>([30, 10, 50, 20, 40], { enableOrderStatistic: true });
1785
+ console.log(tree.getByRank(0)); // 10;
1786
+ console.log(tree.getByRank(4)); // 50;
1787
+ console.log(tree.getRank(30)); // 2;
1788
+ ```
1789
+
1790
+ ##### Inherited from
1791
+
1792
+ [`BST`](BST.md).[`getByRank`](BST.md#getbyrank)
1793
+
1794
+ #### Call Signature
1795
+
1796
+ ```ts
1797
+ getByRank<C>(
1798
+ k,
1799
+ callback,
1800
+ iterationType?): ReturnType<C> | undefined;
1801
+ ```
1802
+
1803
+ 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)
1804
+
1805
+ Returns the element at the k-th position in tree order and applies a callback.
1806
+
1807
+ ##### Type Parameters
1808
+
1809
+ ###### C
1810
+
1811
+ `C` *extends* `NodeCallback`\<[`BSTNode`](BSTNode.md)\<`K`, `V`\>\>
1812
+
1813
+ ##### Parameters
1814
+
1815
+ ###### k
1816
+
1817
+ `number`
1818
+
1819
+ The 0-based position in tree order (0 = first element).
1820
+
1821
+ ###### callback
1822
+
1823
+ `C`
1824
+
1825
+ Callback to apply to the found node.
1826
+
1827
+ ###### iterationType?
1828
+
1829
+ `IterationType`
1830
+
1831
+ Iteration strategy ('ITERATIVE' or 'RECURSIVE').
1832
+
1833
+ ##### Returns
1834
+
1835
+ `ReturnType`\<`C`\> \| `undefined`
1836
+
1837
+ The callback result, or `undefined` if out of bounds.
1838
+
1839
+ ##### Remarks
1840
+
1841
+ Time O(log n), Space O(1) iterative / O(log n) recursive. Requires `enableOrderStatistic: true`.
1842
+
1843
+ ##### Inherited from
1844
+
1845
+ [`BST`](BST.md).[`getByRank`](BST.md#getbyrank)
1846
+
1847
+ ***
1848
+
1748
1849
  ### getDepth()
1749
1850
 
1750
1851
  ```ts
1751
1852
  getDepth(dist, startNode?): number;
1752
1853
  ```
1753
1854
 
1754
- 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)
1855
+ 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)
1755
1856
 
1756
1857
  Gets the depth of a node (distance from `startNode`).
1757
1858
 
@@ -1815,7 +1916,7 @@ IBinaryTree.getDepth
1815
1916
  getHeight(startNode?, iterationType?): number;
1816
1917
  ```
1817
1918
 
1818
- 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)
1919
+ 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)
1819
1920
 
1820
1921
  Gets the maximum height of the tree (longest path from startNode to a leaf).
1821
1922
 
@@ -1898,7 +1999,7 @@ The traversal method.
1898
1999
  getLeftMost(): K | undefined;
1899
2000
  ```
1900
2001
 
1901
- 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)
2002
+ 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)
1902
2003
 
1903
2004
  ##### Returns
1904
2005
 
@@ -1923,7 +2024,7 @@ getLeftMost<C>(
1923
2024
  iterationType?): ReturnType<C>;
1924
2025
  ```
1925
2026
 
1926
- 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)
2027
+ 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)
1927
2028
 
1928
2029
  ##### Type Parameters
1929
2030
 
@@ -1970,7 +2071,7 @@ IBinaryTree.getLeftMost
1970
2071
  getMinHeight(startNode?, iterationType?): number;
1971
2072
  ```
1972
2073
 
1973
- 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)
2074
+ 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)
1974
2075
 
1975
2076
  Gets the minimum height of the tree (shortest path from startNode to a leaf).
1976
2077
 
@@ -2022,7 +2123,7 @@ getNode(
2022
2123
  iterationType?): OptNode<BSTNode<K, V>>;
2023
2124
  ```
2024
2125
 
2025
- 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)
2126
+ 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)
2026
2127
 
2027
2128
  Gets the first node matching a predicate.
2028
2129
 
@@ -2095,7 +2196,7 @@ getNodes(
2095
2196
  iterationType?): BinaryTreeNode<K, V>[];
2096
2197
  ```
2097
2198
 
2098
- 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)
2199
+ 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)
2099
2200
 
2100
2201
  Gets all nodes matching a predicate.
2101
2202
 
@@ -2190,7 +2291,7 @@ If true, returns the path from root-to-node.
2190
2291
  getPathToRoot(beginNode): (K | undefined)[];
2191
2292
  ```
2192
2293
 
2193
- 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)
2294
+ 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)
2194
2295
 
2195
2296
  ##### Parameters
2196
2297
 
@@ -2225,7 +2326,7 @@ getPathToRoot<C>(
2225
2326
  isReverse?): ReturnType<C>[];
2226
2327
  ```
2227
2328
 
2228
- 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)
2329
+ 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)
2229
2330
 
2230
2331
  ##### Type Parameters
2231
2332
 
@@ -2273,7 +2374,7 @@ IBinaryTree.getPathToRoot
2273
2374
  getPredecessor(node): BinaryTreeNode<K, V>;
2274
2375
  ```
2275
2376
 
2276
- 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)
2377
+ 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)
2277
2378
 
2278
2379
  Gets the Morris traversal predecessor (rightmost node in the left subtree, or node itself).
2279
2380
 
@@ -2301,6 +2402,91 @@ This is primarily a helper for Morris traversal. Time O(H), where H is the heigh
2301
2402
 
2302
2403
  ***
2303
2404
 
2405
+ ### getRank()
2406
+
2407
+ #### Call Signature
2408
+
2409
+ ```ts
2410
+ getRank(keyNodeEntryOrPredicate): number;
2411
+ ```
2412
+
2413
+ 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)
2414
+
2415
+ Returns the 0-based rank of a key (number of elements that precede it in tree order).
2416
+
2417
+ ##### Parameters
2418
+
2419
+ ###### keyNodeEntryOrPredicate
2420
+
2421
+ \| `K`
2422
+ \| [`BSTNode`](BSTNode.md)\<`K`, `V`\>
2423
+ \| \[`K` \| `null` \| `undefined`, `V` \| `undefined`\]
2424
+ \| `NodePredicate`\<[`BSTNode`](BSTNode.md)\<`K`, `V`\>\>
2425
+ \| `null`
2426
+ \| `undefined`
2427
+
2428
+ The key, node, entry `[K, V]`, or predicate to find.
2429
+
2430
+ ##### Returns
2431
+
2432
+ `number`
2433
+
2434
+ The rank (0-indexed), or -1 if the tree is empty or input is invalid.
2435
+
2436
+ ##### Remarks
2437
+
2438
+ Time O(log n), Space O(1) iterative / O(log n) recursive. Requires `enableOrderStatistic: true`.
2439
+ Tree order is defined by the comparator. When the key is not found, returns the insertion position.
2440
+
2441
+ ##### Inherited from
2442
+
2443
+ [`BST`](BST.md).[`getRank`](BST.md#getrank)
2444
+
2445
+ #### Call Signature
2446
+
2447
+ ```ts
2448
+ getRank(keyNodeEntryOrPredicate, iterationType): number;
2449
+ ```
2450
+
2451
+ 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)
2452
+
2453
+ Returns the 0-based rank (number of preceding elements in tree order) with explicit iteration type.
2454
+
2455
+ ##### Parameters
2456
+
2457
+ ###### keyNodeEntryOrPredicate
2458
+
2459
+ \| `K`
2460
+ \| [`BSTNode`](BSTNode.md)\<`K`, `V`\>
2461
+ \| \[`K` \| `null` \| `undefined`, `V` \| `undefined`\]
2462
+ \| `NodePredicate`\<[`BSTNode`](BSTNode.md)\<`K`, `V`\>\>
2463
+ \| `null`
2464
+ \| `undefined`
2465
+
2466
+ The key, node, entry, or predicate to find.
2467
+
2468
+ ###### iterationType
2469
+
2470
+ `IterationType`
2471
+
2472
+ Iteration strategy ('ITERATIVE' or 'RECURSIVE').
2473
+
2474
+ ##### Returns
2475
+
2476
+ `number`
2477
+
2478
+ The rank (0-indexed), or -1 if the tree is empty or input is invalid.
2479
+
2480
+ ##### Remarks
2481
+
2482
+ Time O(log n), Space O(1) iterative / O(log n) recursive. Requires `enableOrderStatistic: true`.
2483
+
2484
+ ##### Inherited from
2485
+
2486
+ [`BST`](BST.md).[`getRank`](BST.md#getrank)
2487
+
2488
+ ***
2489
+
2304
2490
  ### getRightMost()
2305
2491
 
2306
2492
  Finds the rightmost node in a subtree (the node with the largest key in a BST).
@@ -2331,7 +2517,7 @@ The traversal method.
2331
2517
  getRightMost(): K | undefined;
2332
2518
  ```
2333
2519
 
2334
- 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)
2520
+ 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)
2335
2521
 
2336
2522
  ##### Returns
2337
2523
 
@@ -2356,7 +2542,7 @@ getRightMost<C>(
2356
2542
  iterationType?): ReturnType<C>;
2357
2543
  ```
2358
2544
 
2359
- 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)
2545
+ 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)
2360
2546
 
2361
2547
  ##### Type Parameters
2362
2548
 
@@ -2403,7 +2589,7 @@ IBinaryTree.getRightMost
2403
2589
  getSuccessor(x?): BinaryTreeNode<K, V> | null | undefined;
2404
2590
  ```
2405
2591
 
2406
- 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)
2592
+ 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)
2407
2593
 
2408
2594
  Gets the in-order successor of a node in a BST.
2409
2595
 
@@ -2440,7 +2626,7 @@ has(
2440
2626
  iterationType?): boolean;
2441
2627
  ```
2442
2628
 
2443
- 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)
2629
+ 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)
2444
2630
 
2445
2631
  Checks if a node matching the predicate exists in the tree.
2446
2632
 
@@ -2533,7 +2719,7 @@ IBinaryTree.has
2533
2719
  hasValue(value): boolean;
2534
2720
  ```
2535
2721
 
2536
- 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)
2722
+ 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)
2537
2723
 
2538
2724
  Whether there exists an entry with the given value.
2539
2725
 
@@ -2575,7 +2761,7 @@ IBinaryTree.hasValue
2575
2761
  higher(keyNodeEntryOrPredicate): K | undefined;
2576
2762
  ```
2577
2763
 
2578
- 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)
2764
+ 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)
2579
2765
 
2580
2766
  Returns the first key with a value > target.
2581
2767
  Equivalent to Java TreeMap.higher.
@@ -2621,7 +2807,7 @@ higher<C>(
2621
2807
  iterationType?): ReturnType<C>;
2622
2808
  ```
2623
2809
 
2624
- 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)
2810
+ 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)
2625
2811
 
2626
2812
  Returns the first node with a key > target and applies callback.
2627
2813
  Time Complexity: O(log n) average, O(h) worst case.
@@ -2668,7 +2854,7 @@ Space Complexity: O(h) for recursion, O(1) for iteration.
2668
2854
  isAVLBalanced(iterationType?): boolean;
2669
2855
  ```
2670
2856
 
2671
- 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)
2857
+ 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)
2672
2858
 
2673
2859
  Checks if the tree meets the AVL balance condition (height difference <= 1).
2674
2860
 
@@ -2712,7 +2898,7 @@ Time O(N), as it must visit every node to compute height. Space O(log N) for rec
2712
2898
  isBST(startNode?, iterationType?): boolean;
2713
2899
  ```
2714
2900
 
2715
- 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)
2901
+ 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)
2716
2902
 
2717
2903
  Checks if the tree is a valid Binary Search Tree (BST).
2718
2904
 
@@ -2772,7 +2958,7 @@ IBinaryTree.isBST
2772
2958
  isEmpty(): boolean;
2773
2959
  ```
2774
2960
 
2775
- 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)
2961
+ 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)
2776
2962
 
2777
2963
  Checks if the tree is empty.
2778
2964
 
@@ -2813,7 +2999,7 @@ IBinaryTree.isEmpty
2813
2999
  isEntry(keyNodeOrEntry): keyNodeOrEntry is BTNEntry<K, V>;
2814
3000
  ```
2815
3001
 
2816
- 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)
3002
+ 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)
2817
3003
 
2818
3004
  Checks if the given item is a [key, value] entry pair.
2819
3005
 
@@ -2851,7 +3037,7 @@ Time O(1), Space O(1)
2851
3037
  isLeaf(keyNodeOrEntry): boolean;
2852
3038
  ```
2853
3039
 
2854
- 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)
3040
+ 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)
2855
3041
 
2856
3042
  Checks if a node is a leaf (has no real children).
2857
3043
 
@@ -2889,7 +3075,7 @@ Time O(N) if a key/entry is passed (due to `ensureNode`). O(1) if a node is pass
2889
3075
  isNIL(keyNodeOrEntry): boolean;
2890
3076
  ```
2891
3077
 
2892
- 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)
3078
+ 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)
2893
3079
 
2894
3080
  Checks if the given item is the sentinel NIL node.
2895
3081
 
@@ -2927,7 +3113,7 @@ Time O(1), Space O(1)
2927
3113
  isNode(keyNodeOrEntry): keyNodeOrEntry is AVLTreeNode<K, V>;
2928
3114
  ```
2929
3115
 
2930
- Defined in: [data-structures/binary-tree/avl-tree.ts:350](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/avl-tree.ts#L350)
3116
+ Defined in: [data-structures/binary-tree/avl-tree.ts:350](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/avl-tree.ts#L350)
2931
3117
 
2932
3118
  Checks if the given item is an `AVLTreeNode` instance.
2933
3119
 
@@ -2965,7 +3151,7 @@ Time O(1), Space O(1)
2965
3151
  isPerfectlyBalanced(startNode?): boolean;
2966
3152
  ```
2967
3153
 
2968
- 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)
3154
+ 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)
2969
3155
 
2970
3156
  Checks if the tree is perfectly balanced.
2971
3157
 
@@ -3008,7 +3194,7 @@ IBinaryTree.isPerfectlyBalanced
3008
3194
  isRange(keyNodeEntryOrPredicate): keyNodeEntryOrPredicate is Range<K>;
3009
3195
  ```
3010
3196
 
3011
- 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)
3197
+ 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)
3012
3198
 
3013
3199
  Checks if the given item is a `Range` object.
3014
3200
 
@@ -3048,7 +3234,7 @@ Time O(1), Space O(1)
3048
3234
  isRaw(keyNodeEntryOrRaw): keyNodeEntryOrRaw is R;
3049
3235
  ```
3050
3236
 
3051
- 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)
3237
+ 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)
3052
3238
 
3053
3239
  Checks if the given item is a raw data object (R) that needs conversion via `toEntryFn`.
3054
3240
 
@@ -3087,7 +3273,7 @@ Time O(1), Space O(1)
3087
3273
  isRealNode(keyNodeOrEntry): keyNodeOrEntry is BinaryTreeNode<K, V>;
3088
3274
  ```
3089
3275
 
3090
- 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)
3276
+ 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)
3091
3277
 
3092
3278
  Checks if the given item is a "real" node (i.e., not null, undefined, or NIL).
3093
3279
 
@@ -3125,7 +3311,7 @@ Time O(1), Space O(1)
3125
3311
  isRealNodeOrNull(keyNodeOrEntry): keyNodeOrEntry is BinaryTreeNode<K, V> | null;
3126
3312
  ```
3127
3313
 
3128
- 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)
3314
+ 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)
3129
3315
 
3130
3316
  Checks if the given item is either a "real" node or null.
3131
3317
 
@@ -3163,7 +3349,7 @@ Time O(1), Space O(1)
3163
3349
  isValidKey(key): key is K;
3164
3350
  ```
3165
3351
 
3166
- 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)
3352
+ 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)
3167
3353
 
3168
3354
  Checks if the given key is valid (comparable).
3169
3355
 
@@ -3171,7 +3357,7 @@ Checks if the given key is valid (comparable).
3171
3357
 
3172
3358
  ##### key
3173
3359
 
3174
- `any`
3360
+ `unknown`
3175
3361
 
3176
3362
  The key to validate.
3177
3363
 
@@ -3197,7 +3383,7 @@ Time O(1)
3197
3383
  keys(): IterableIterator<K>;
3198
3384
  ```
3199
3385
 
3200
- 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)
3386
+ 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)
3201
3387
 
3202
3388
  Iterate over keys only.
3203
3389
 
@@ -3253,7 +3439,7 @@ The traversal method.
3253
3439
  leaves(): (K | undefined)[];
3254
3440
  ```
3255
3441
 
3256
- 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)
3442
+ 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)
3257
3443
 
3258
3444
  Get leaf nodes
3259
3445
 
@@ -3291,7 +3477,7 @@ leaves<C>(
3291
3477
  iterationType?): ReturnType<C>[];
3292
3478
  ```
3293
3479
 
3294
- 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)
3480
+ 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)
3295
3481
 
3296
3482
  Get leaf nodes
3297
3483
 
@@ -3379,7 +3565,7 @@ The traversal method.
3379
3565
  lesserOrGreaterTraverse(): (K | undefined)[];
3380
3566
  ```
3381
3567
 
3382
- 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)
3568
+ 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)
3383
3569
 
3384
3570
  ##### Returns
3385
3571
 
@@ -3399,7 +3585,7 @@ lesserOrGreaterTraverse<C>(
3399
3585
  iterationType?): ReturnType<C>[];
3400
3586
  ```
3401
3587
 
3402
- 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)
3588
+ 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)
3403
3589
 
3404
3590
  ##### Type Parameters
3405
3591
 
@@ -3468,7 +3654,7 @@ The traversal method.
3468
3654
  listLevels(): (K | undefined)[][];
3469
3655
  ```
3470
3656
 
3471
- 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)
3657
+ 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)
3472
3658
 
3473
3659
  Level-order grouping
3474
3660
 
@@ -3509,7 +3695,7 @@ listLevels<C>(
3509
3695
  iterationType?): ReturnType<C>[][];
3510
3696
  ```
3511
3697
 
3512
- 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)
3698
+ 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)
3513
3699
 
3514
3700
  Level-order grouping
3515
3701
 
@@ -3574,7 +3760,7 @@ IBinaryTree.listLevels
3574
3760
  lower(keyNodeEntryOrPredicate): K | undefined;
3575
3761
  ```
3576
3762
 
3577
- 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)
3763
+ 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)
3578
3764
 
3579
3765
  Returns the first key with a value < target.
3580
3766
  Equivalent to Java TreeMap.lower.
@@ -3620,7 +3806,7 @@ lower<C>(
3620
3806
  iterationType?): ReturnType<C>;
3621
3807
  ```
3622
3808
 
3623
- 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)
3809
+ 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)
3624
3810
 
3625
3811
  Returns the first node with a key < target and applies callback.
3626
3812
  Time Complexity: O(log n) average, O(h) worst case.
@@ -3670,7 +3856,7 @@ map<MK, MV, MR>(
3670
3856
  thisArg?): AVLTree<MK, MV, MR>;
3671
3857
  ```
3672
3858
 
3673
- Defined in: [data-structures/binary-tree/avl-tree.ts:776](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/avl-tree.ts#L776)
3859
+ Defined in: [data-structures/binary-tree/avl-tree.ts:860](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/avl-tree.ts#L860)
3674
3860
 
3675
3861
  Creates a new AVLTree by mapping each [key, value] pair.
3676
3862
 
@@ -3753,7 +3939,7 @@ IBinaryTree.map
3753
3939
  merge(anotherTree): void;
3754
3940
  ```
3755
3941
 
3756
- 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)
3942
+ 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)
3757
3943
 
3758
3944
  Merges another tree into this one by seting all its nodes.
3759
3945
 
@@ -3827,7 +4013,7 @@ The node to start from.
3827
4013
  morris(): (K | undefined)[];
3828
4014
  ```
3829
4015
 
3830
- 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)
4016
+ 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)
3831
4017
 
3832
4018
  Morris traversal (O(1) space)
3833
4019
 
@@ -3865,7 +4051,7 @@ morris<C>(
3865
4051
  startNode?): ReturnType<C>[];
3866
4052
  ```
3867
4053
 
3868
- 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)
4054
+ 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)
3869
4055
 
3870
4056
  Morris traversal (O(1) space)
3871
4057
 
@@ -3925,7 +4111,7 @@ IBinaryTree.morris
3925
4111
  perfectlyBalance(iterationType?): boolean;
3926
4112
  ```
3927
4113
 
3928
- Defined in: [data-structures/binary-tree/avl-tree.ts:657](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/avl-tree.ts#L657)
4114
+ Defined in: [data-structures/binary-tree/avl-tree.ts:720](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/avl-tree.ts#L720)
3929
4115
 
3930
4116
  Rebuilds the tree to be perfectly balanced.
3931
4117
 
@@ -3974,7 +4160,7 @@ Time O(N) (O(N) for DFS, O(N) for sorted build). Space O(N) for node array and r
3974
4160
  print(options?, startNode?): void;
3975
4161
  ```
3976
4162
 
3977
- 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)
4163
+ 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)
3978
4164
 
3979
4165
  Prints a visual representation of the tree to the console.
3980
4166
 
@@ -4019,6 +4205,108 @@ Time O(N) (via `toVisual`). Space O(N*H) or O(N^2) (via `toVisual`).
4019
4205
 
4020
4206
  ***
4021
4207
 
4208
+ ### rangeByRank()
4209
+
4210
+ #### Call Signature
4211
+
4212
+ ```ts
4213
+ rangeByRank(start, end): (K | undefined)[];
4214
+ ```
4215
+
4216
+ 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)
4217
+
4218
+ Returns elements by position range in tree order (0-indexed, inclusive on both ends).
4219
+
4220
+ ##### Parameters
4221
+
4222
+ ###### start
4223
+
4224
+ `number`
4225
+
4226
+ Start position (inclusive, 0-indexed). Clamped to 0 if negative.
4227
+
4228
+ ###### end
4229
+
4230
+ `number`
4231
+
4232
+ End position (inclusive, 0-indexed). Clamped to size-1 if too large.
4233
+
4234
+ ##### Returns
4235
+
4236
+ (`K` \| `undefined`)[]
4237
+
4238
+ Array of keys in tree order within the specified range.
4239
+
4240
+ ##### Remarks
4241
+
4242
+ Time O(log n + k), Space O(k), where k = end - start + 1. Requires `enableOrderStatistic: true`.
4243
+
4244
+ ##### Inherited from
4245
+
4246
+ [`BST`](BST.md).[`rangeByRank`](BST.md#rangebyrank)
4247
+
4248
+ #### Call Signature
4249
+
4250
+ ```ts
4251
+ rangeByRank<C>(
4252
+ start,
4253
+ end,
4254
+ callback,
4255
+ iterationType?): ReturnType<C>[];
4256
+ ```
4257
+
4258
+ 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)
4259
+
4260
+ Returns elements by position range in tree order with callback and optional iteration type.
4261
+
4262
+ ##### Type Parameters
4263
+
4264
+ ###### C
4265
+
4266
+ `C` *extends* `NodeCallback`\<[`BSTNode`](BSTNode.md)\<`K`, `V`\>\>
4267
+
4268
+ ##### Parameters
4269
+
4270
+ ###### start
4271
+
4272
+ `number`
4273
+
4274
+ Start rank (inclusive, 0-indexed).
4275
+
4276
+ ###### end
4277
+
4278
+ `number`
4279
+
4280
+ End rank (inclusive, 0-indexed).
4281
+
4282
+ ###### callback
4283
+
4284
+ `C`
4285
+
4286
+ Callback to apply to each node in the range.
4287
+
4288
+ ###### iterationType?
4289
+
4290
+ `IterationType`
4291
+
4292
+ Iteration strategy ('ITERATIVE' or 'RECURSIVE').
4293
+
4294
+ ##### Returns
4295
+
4296
+ `ReturnType`\<`C`\>[]
4297
+
4298
+ Array of callback results for nodes in the rank range.
4299
+
4300
+ ##### Remarks
4301
+
4302
+ Time O(log n + k), Space O(k), where k = end - start + 1. Requires `enableOrderStatistic: true`.
4303
+
4304
+ ##### Inherited from
4305
+
4306
+ [`BST`](BST.md).[`rangeByRank`](BST.md#rangebyrank)
4307
+
4308
+ ***
4309
+
4022
4310
  ### rangeSearch()
4023
4311
 
4024
4312
  Performs an optimized search for nodes within a given key range.
@@ -4053,7 +4341,7 @@ The traversal method.
4053
4341
  rangeSearch(range): (K | undefined)[];
4054
4342
  ```
4055
4343
 
4056
- 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)
4344
+ 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)
4057
4345
 
4058
4346
  Find all keys in a range
4059
4347
 
@@ -4091,7 +4379,7 @@ rangeSearch<C>(
4091
4379
  iterationType?): ReturnType<C>[];
4092
4380
  ```
4093
4381
 
4094
- 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)
4382
+ 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)
4095
4383
 
4096
4384
  Find all keys in a range
4097
4385
 
@@ -4148,7 +4436,7 @@ Find all keys in a range
4148
4436
  reduce<U>(callbackfn, initialValue): U;
4149
4437
  ```
4150
4438
 
4151
- 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)
4439
+ 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)
4152
4440
 
4153
4441
  Reduce entries into a single accumulator.
4154
4442
 
@@ -4200,7 +4488,7 @@ IBinaryTree.reduce
4200
4488
  refill(keysNodesEntriesOrRaws, values?): void;
4201
4489
  ```
4202
4490
 
4203
- 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)
4491
+ 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)
4204
4492
 
4205
4493
  Clears the tree and refills it with new items.
4206
4494
 
@@ -4284,7 +4572,7 @@ Whether to use 'RECURSIVE' or 'ITERATIVE' search.
4284
4572
  search(keyNodeEntryOrPredicate, onlyOne?): (K | undefined)[];
4285
4573
  ```
4286
4574
 
4287
- 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)
4575
+ 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)
4288
4576
 
4289
4577
  Search nodes by predicate
4290
4578
 
@@ -4340,7 +4628,7 @@ search<C>(
4340
4628
  iterationType?): ReturnType<C>[];
4341
4629
  ```
4342
4630
 
4343
- 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)
4631
+ 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)
4344
4632
 
4345
4633
  Search nodes by predicate
4346
4634
 
@@ -4414,7 +4702,7 @@ IBinaryTree.search
4414
4702
  set(keyNodeOrEntry, value?): boolean;
4415
4703
  ```
4416
4704
 
4417
- Defined in: [data-structures/binary-tree/avl-tree.ts:474](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/avl-tree.ts#L474)
4705
+ Defined in: [data-structures/binary-tree/avl-tree.ts:502](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/avl-tree.ts#L502)
4418
4706
 
4419
4707
  Sets a new node to the AVL tree and balances the tree path.
4420
4708
 
@@ -4480,7 +4768,7 @@ setMany(
4480
4768
  iterationType?): boolean[];
4481
4769
  ```
4482
4770
 
4483
- 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)
4771
+ 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)
4484
4772
 
4485
4773
  Adds multiple items to the tree.
4486
4774
 
@@ -4546,7 +4834,7 @@ Space O(N) for sorting and recursion/iteration stack.
4546
4834
  some(predicate, thisArg?): boolean;
4547
4835
  ```
4548
4836
 
4549
- 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)
4837
+ 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)
4550
4838
 
4551
4839
  Test whether any entry satisfies the predicate.
4552
4840
 
@@ -4560,7 +4848,7 @@ Test whether any entry satisfies the predicate.
4560
4848
 
4561
4849
  ##### thisArg?
4562
4850
 
4563
- `any`
4851
+ `unknown`
4564
4852
 
4565
4853
  Optional `this` for callback.
4566
4854
 
@@ -4592,7 +4880,7 @@ IBinaryTree.some
4592
4880
  toArray(): [K, V | undefined][];
4593
4881
  ```
4594
4882
 
4595
- 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)
4883
+ 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)
4596
4884
 
4597
4885
  Converts data structure to `[key, value]` pairs.
4598
4886
 
@@ -4618,7 +4906,7 @@ Time O(n), Space O(n)
4618
4906
  toVisual(startNode?, options?): string;
4619
4907
  ```
4620
4908
 
4621
- 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)
4909
+ 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)
4622
4910
 
4623
4911
  Generates a string representation of the tree for visualization.
4624
4912
 
@@ -4661,7 +4949,7 @@ Time O(N), visits every node. Space O(N*H) or O(N^2) in the worst case, as the s
4661
4949
  values(): IterableIterator<V | undefined>;
4662
4950
  ```
4663
4951
 
4664
- 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)
4952
+ 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)
4665
4953
 
4666
4954
  Iterate over values only.
4667
4955
 
@@ -4696,7 +4984,7 @@ IBinaryTree.values
4696
4984
  protected readonly _comparator: Comparator<K>;
4697
4985
  ```
4698
4986
 
4699
- 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)
4987
+ 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)
4700
4988
 
4701
4989
  The comparator function used to determine the order of keys in the tree.
4702
4990
 
@@ -4716,7 +5004,7 @@ Time O(1) Space O(1)
4716
5004
  protected readonly _DEFAULT_NODE_CALLBACK: NodeCallback<BinaryTreeNode<K, V> | null | undefined, K | undefined>;
4717
5005
  ```
4718
5006
 
4719
- 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)
5007
+ 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)
4720
5008
 
4721
5009
  (Protected) Default callback function, returns the node's key.
4722
5010
 
@@ -4744,7 +5032,7 @@ The node's key or undefined.
4744
5032
  protected _balanceFactor(node): number;
4745
5033
  ```
4746
5034
 
4747
- Defined in: [data-structures/binary-tree/avl-tree.ts:874](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/avl-tree.ts#L874)
5035
+ Defined in: [data-structures/binary-tree/avl-tree.ts:958](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/avl-tree.ts#L958)
4748
5036
 
4749
5037
  (Protected) Calculates the balance factor (height(right) - height(left)).
4750
5038
 
@@ -4774,7 +5062,7 @@ Time O(1) (assumes heights are stored).
4774
5062
  protected _balanceLL(A): void;
4775
5063
  ```
4776
5064
 
4777
- Defined in: [data-structures/binary-tree/avl-tree.ts:898](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/avl-tree.ts#L898)
5065
+ Defined in: [data-structures/binary-tree/avl-tree.ts:982](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/avl-tree.ts#L982)
4778
5066
 
4779
5067
  (Protected) Performs a Left-Left (LL) rotation (a single right rotation).
4780
5068
 
@@ -4802,7 +5090,7 @@ Time O(1), Space O(1)
4802
5090
  protected _balanceLR(A): void;
4803
5091
  ```
4804
5092
 
4805
- Defined in: [data-structures/binary-tree/avl-tree.ts:933](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/avl-tree.ts#L933)
5093
+ Defined in: [data-structures/binary-tree/avl-tree.ts:1019](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/avl-tree.ts#L1019)
4806
5094
 
4807
5095
  (Protected) Performs a Left-Right (LR) double rotation.
4808
5096
 
@@ -4830,7 +5118,7 @@ Time O(1), Space O(1)
4830
5118
  protected _balancePath(node): void;
4831
5119
  ```
4832
5120
 
4833
- Defined in: [data-structures/binary-tree/avl-tree.ts:1075](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/avl-tree.ts#L1075)
5121
+ Defined in: [data-structures/binary-tree/avl-tree.ts:1169](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/avl-tree.ts#L1169)
4834
5122
 
4835
5123
  (Protected) Traverses up the tree from the specified node, updating heights and performing rotations as needed.
4836
5124
 
@@ -4862,7 +5150,7 @@ Time O(log N) (O(H)), as it traverses the path to root. Space O(H) for the path
4862
5150
  protected _balanceRL(A): void;
4863
5151
  ```
4864
5152
 
4865
- Defined in: [data-structures/binary-tree/avl-tree.ts:1024](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/avl-tree.ts#L1024)
5153
+ Defined in: [data-structures/binary-tree/avl-tree.ts:1115](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/avl-tree.ts#L1115)
4866
5154
 
4867
5155
  (Protected) Performs a Right-Left (RL) double rotation.
4868
5156
 
@@ -4890,7 +5178,7 @@ Time O(1), Space O(1)
4890
5178
  protected _balanceRR(A): void;
4891
5179
  ```
4892
5180
 
4893
- Defined in: [data-structures/binary-tree/avl-tree.ts:985](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/avl-tree.ts#L985)
5181
+ Defined in: [data-structures/binary-tree/avl-tree.ts:1074](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/avl-tree.ts#L1074)
4894
5182
 
4895
5183
  (Protected) Performs a Right-Right (RR) rotation (a single left rotation).
4896
5184
 
@@ -4921,7 +5209,7 @@ protected _bound(
4921
5209
  iterationType): BSTNode<K, V> | undefined;
4922
5210
  ```
4923
5211
 
4924
- 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)
5212
+ 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)
4925
5213
 
4926
5214
  (Protected) Core bound search implementation supporting all parameter types.
4927
5215
  Unified logic for both lowerBound and upperBound.
@@ -4973,7 +5261,7 @@ protected _boundByKey(
4973
5261
  iterationType): BSTNode<K, V> | undefined;
4974
5262
  ```
4975
5263
 
4976
- 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)
5264
+ 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)
4977
5265
 
4978
5266
  (Protected) Binary search for bound by key with pruning optimization.
4979
5267
  Performs standard BST binary search, choosing left or right subtree based on comparator result.
@@ -5018,7 +5306,7 @@ The first node matching the bound condition, or undefined if none exists.
5018
5306
  protected _boundByPredicate(predicate, iterationType): BSTNode<K, V> | undefined;
5019
5307
  ```
5020
5308
 
5021
- 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)
5309
+ 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)
5022
5310
 
5023
5311
  (Protected) In-order traversal search by predicate.
5024
5312
  Falls back to linear in-order traversal when predicate-based search is required.
@@ -5058,7 +5346,7 @@ The first node satisfying predicate, or undefined if none found.
5058
5346
  protected _clearNodes(): void;
5059
5347
  ```
5060
5348
 
5061
- 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)
5349
+ 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)
5062
5350
 
5063
5351
  (Protected) Clears all nodes from the tree.
5064
5352
 
@@ -5082,7 +5370,7 @@ Time O(1)
5082
5370
  protected _clearValues(): void;
5083
5371
  ```
5084
5372
 
5085
- 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)
5373
+ 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)
5086
5374
 
5087
5375
  (Protected) Clears all values from the external store.
5088
5376
 
@@ -5106,7 +5394,7 @@ Time O(N)
5106
5394
  protected _clone(cloned): void;
5107
5395
  ```
5108
5396
 
5109
- 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)
5397
+ 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)
5110
5398
 
5111
5399
  (Protected) Helper for cloning. Performs a BFS and sets all nodes to the new tree.
5112
5400
 
@@ -5138,7 +5426,7 @@ Time O(N * M) (O(N) BFS + O(M) `set` for each node).
5138
5426
  protected _compare(a, b): number;
5139
5427
  ```
5140
5428
 
5141
- 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)
5429
+ 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)
5142
5430
 
5143
5431
  (Protected) Compares two keys using the tree's comparator and reverse setting.
5144
5432
 
@@ -5178,7 +5466,7 @@ Time O(1) Space O(1)
5178
5466
  protected _createDefaultComparator(): Comparator<K>;
5179
5467
  ```
5180
5468
 
5181
- 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)
5469
+ 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)
5182
5470
 
5183
5471
  (Protected) Creates the default comparator function for keys that don't have a custom comparator.
5184
5472
 
@@ -5204,7 +5492,7 @@ Time O(1) Space O(1)
5204
5492
  protected _createInstance<TK, TV, TR>(options?): this;
5205
5493
  ```
5206
5494
 
5207
- Defined in: [data-structures/binary-tree/avl-tree.ts:800](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/avl-tree.ts#L800)
5495
+ Defined in: [data-structures/binary-tree/avl-tree.ts:884](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/avl-tree.ts#L884)
5208
5496
 
5209
5497
  (Protected) Creates a new, empty instance of the same AVLTree constructor.
5210
5498
 
@@ -5252,7 +5540,7 @@ Time O(1)
5252
5540
  protected _createLike<TK, TV, TR>(iter?, options?): AVLTree<TK, TV, TR>;
5253
5541
  ```
5254
5542
 
5255
- Defined in: [data-structures/binary-tree/avl-tree.ts:817](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/avl-tree.ts#L817)
5543
+ Defined in: [data-structures/binary-tree/avl-tree.ts:901](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/avl-tree.ts#L901)
5256
5544
 
5257
5545
  (Protected) Creates a new instance of the same AVLTree constructor, potentially with different generic types.
5258
5546
 
@@ -5312,7 +5600,7 @@ Time O(N log N) (from constructor) due to processing the iterable.
5312
5600
  protected _deleteByKey(key): boolean;
5313
5601
  ```
5314
5602
 
5315
- 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)
5603
+ 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)
5316
5604
 
5317
5605
  (Private) Deletes a node by its key.
5318
5606
 
@@ -5356,7 +5644,7 @@ protected _dfs<C>(
5356
5644
  shouldProcessRoot?): ReturnType<C>[];
5357
5645
  ```
5358
5646
 
5359
- 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)
5647
+ 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)
5360
5648
 
5361
5649
  #### Type Parameters
5362
5650
 
@@ -5449,7 +5737,7 @@ Array of callback results.
5449
5737
  protected _displayAux(node, options): NodeDisplayLayout;
5450
5738
  ```
5451
5739
 
5452
- 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)
5740
+ 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)
5453
5741
 
5454
5742
  (Protected) Recursive helper for `toVisual`.
5455
5743
 
@@ -5489,7 +5777,7 @@ Time O(N), Space O(N*H) or O(N^2)
5489
5777
  protected _ensurePredicate(keyNodeEntryOrPredicate): NodePredicate<BinaryTreeNode<K, V>>;
5490
5778
  ```
5491
5779
 
5492
- 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)
5780
+ 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)
5493
5781
 
5494
5782
  (Protected) Converts a key, node, entry, or predicate into a standardized predicate function.
5495
5783
 
@@ -5528,7 +5816,7 @@ Time O(1)
5528
5816
  protected _extractKey(keyNodeOrEntry): K | null | undefined;
5529
5817
  ```
5530
5818
 
5531
- 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)
5819
+ 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)
5532
5820
 
5533
5821
  (Protected) Extracts the key from a key, node, or entry.
5534
5822
 
@@ -5566,7 +5854,7 @@ Time O(1)
5566
5854
  protected _floorByKey(key, iterationType): BSTNode<K, V> | undefined;
5567
5855
  ```
5568
5856
 
5569
- 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)
5857
+ 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)
5570
5858
 
5571
5859
  (Protected) Binary search for floor by key with pruning optimization.
5572
5860
  Performs standard BST binary search, choosing left or right subtree based on comparator result.
@@ -5608,7 +5896,7 @@ Time O(h) where h is tree height.
5608
5896
  protected _floorByPredicate(predicate, iterationType): BSTNode<K, V> | undefined;
5609
5897
  ```
5610
5898
 
5611
- 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)
5899
+ 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)
5612
5900
 
5613
5901
  (Protected) In-order traversal search for floor by predicate.
5614
5902
  Falls back to linear in-order traversal when predicate-based search is required.
@@ -5645,13 +5933,81 @@ Space Complexity: O(h) for recursion, O(h) for iterative stack.
5645
5933
 
5646
5934
  ***
5647
5935
 
5936
+ ### \_getByRankIterative()
5937
+
5938
+ ```ts
5939
+ protected _getByRankIterative(node, k): BSTNode<K, V> | undefined;
5940
+ ```
5941
+
5942
+ 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)
5943
+
5944
+ (Protected) Finds the node at position k in tree order (iterative).
5945
+
5946
+ #### Parameters
5947
+
5948
+ ##### node
5949
+
5950
+ `OptNode`\<[`BSTNode`](BSTNode.md)\<`K`, `V`\>\>
5951
+
5952
+ ##### k
5953
+
5954
+ `number`
5955
+
5956
+ #### Returns
5957
+
5958
+ [`BSTNode`](BSTNode.md)\<`K`, `V`\> \| `undefined`
5959
+
5960
+ #### Remarks
5961
+
5962
+ Time O(log n), Space O(1)
5963
+
5964
+ #### Inherited from
5965
+
5966
+ [`BST`](BST.md).[`_getByRankIterative`](BST.md#_getbyrankiterative)
5967
+
5968
+ ***
5969
+
5970
+ ### \_getByRankRecursive()
5971
+
5972
+ ```ts
5973
+ protected _getByRankRecursive(node, k): BSTNode<K, V> | undefined;
5974
+ ```
5975
+
5976
+ 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)
5977
+
5978
+ (Protected) Finds the node at position k in tree order (recursive).
5979
+
5980
+ #### Parameters
5981
+
5982
+ ##### node
5983
+
5984
+ `OptNode`\<[`BSTNode`](BSTNode.md)\<`K`, `V`\>\>
5985
+
5986
+ ##### k
5987
+
5988
+ `number`
5989
+
5990
+ #### Returns
5991
+
5992
+ [`BSTNode`](BSTNode.md)\<`K`, `V`\> \| `undefined`
5993
+
5994
+ #### Remarks
5995
+
5996
+ Time O(log n), Space O(log n) call stack
5997
+
5998
+ #### Inherited from
5999
+
6000
+ [`BST`](BST.md).[`_getByRankRecursive`](BST.md#_getbyrankrecursive)
6001
+
6002
+ ***
6003
+
5648
6004
  ### \_getIterator()
5649
6005
 
5650
6006
  ```ts
5651
6007
  protected _getIterator(node?): IterableIterator<[K, V | undefined]>;
5652
6008
  ```
5653
6009
 
5654
- 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)
6010
+ 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)
5655
6011
 
5656
6012
  (Protected) Gets the iterator for the tree (default in-order).
5657
6013
 
@@ -5679,13 +6035,81 @@ Time O(N) for full iteration. O(H) to get the first element. Space O(H) for the
5679
6035
 
5680
6036
  ***
5681
6037
 
6038
+ ### \_getRankIterative()
6039
+
6040
+ ```ts
6041
+ protected _getRankIterative(node, key): number;
6042
+ ```
6043
+
6044
+ 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)
6045
+
6046
+ (Protected) Computes the rank of a key iteratively.
6047
+
6048
+ #### Parameters
6049
+
6050
+ ##### node
6051
+
6052
+ `OptNode`\<[`BSTNode`](BSTNode.md)\<`K`, `V`\>\>
6053
+
6054
+ ##### key
6055
+
6056
+ `K`
6057
+
6058
+ #### Returns
6059
+
6060
+ `number`
6061
+
6062
+ #### Remarks
6063
+
6064
+ Time O(log n), Space O(1)
6065
+
6066
+ #### Inherited from
6067
+
6068
+ [`BST`](BST.md).[`_getRankIterative`](BST.md#_getrankiterative)
6069
+
6070
+ ***
6071
+
6072
+ ### \_getRankRecursive()
6073
+
6074
+ ```ts
6075
+ protected _getRankRecursive(node, key): number;
6076
+ ```
6077
+
6078
+ 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)
6079
+
6080
+ (Protected) Computes the rank of a key recursively.
6081
+
6082
+ #### Parameters
6083
+
6084
+ ##### node
6085
+
6086
+ `OptNode`\<[`BSTNode`](BSTNode.md)\<`K`, `V`\>\>
6087
+
6088
+ ##### key
6089
+
6090
+ `K`
6091
+
6092
+ #### Returns
6093
+
6094
+ `number`
6095
+
6096
+ #### Remarks
6097
+
6098
+ Time O(log n), Space O(log n) call stack
6099
+
6100
+ #### Inherited from
6101
+
6102
+ [`BST`](BST.md).[`_getRankRecursive`](BST.md#_getrankrecursive)
6103
+
6104
+ ***
6105
+
5682
6106
  ### \_isDisplayLeaf()
5683
6107
 
5684
6108
  ```ts
5685
6109
  protected _isDisplayLeaf(node, options): boolean;
5686
6110
  ```
5687
6111
 
5688
- 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)
6112
+ 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)
5689
6113
 
5690
6114
  Check if a node is a display leaf (empty, null, undefined, NIL, or real leaf).
5691
6115
 
@@ -5715,7 +6139,7 @@ Check if a node is a display leaf (empty, null, undefined, NIL, or real leaf).
5715
6139
  protected _isPredicate(p): p is NodePredicate<BinaryTreeNode<K, V>>;
5716
6140
  ```
5717
6141
 
5718
- 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)
6142
+ 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)
5719
6143
 
5720
6144
  (Protected) Checks if an item is a predicate function.
5721
6145
 
@@ -5723,7 +6147,7 @@ Defined in: [data-structures/binary-tree/binary-tree.ts:3305](https://github.com
5723
6147
 
5724
6148
  ##### p
5725
6149
 
5726
- `any`
6150
+ `unknown`
5727
6151
 
5728
6152
  The item to check.
5729
6153
 
@@ -5749,7 +6173,7 @@ Time O(1)
5749
6173
  protected _keyValueNodeOrEntryToNodeAndValue(keyNodeOrEntry, value?): [OptNode<BSTNode<K, V>>, V | undefined];
5750
6174
  ```
5751
6175
 
5752
- 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)
6176
+ 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)
5753
6177
 
5754
6178
  (Protected) Converts a key, node, or entry into a standardized [node, value] tuple.
5755
6179
 
@@ -5793,7 +6217,7 @@ Time O(1)
5793
6217
  protected _lowerByKey(key, iterationType): BSTNode<K, V> | undefined;
5794
6218
  ```
5795
6219
 
5796
- 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)
6220
+ 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)
5797
6221
 
5798
6222
  (Protected) Binary search for lower by key with pruning optimization.
5799
6223
  Performs standard BST binary search, choosing left or right subtree based on comparator result.
@@ -5835,7 +6259,7 @@ Time O(h) where h is tree height.
5835
6259
  protected _lowerByPredicate(predicate, iterationType): BSTNode<K, V> | undefined;
5836
6260
  ```
5837
6261
 
5838
- 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)
6262
+ 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)
5839
6263
 
5840
6264
  (Protected) In-order traversal search for lower by predicate.
5841
6265
  Falls back to linear in-order traversal when predicate-based search is required.
@@ -5872,13 +6296,43 @@ Space Complexity: O(h) for recursion, O(h) for iterative stack.
5872
6296
 
5873
6297
  ***
5874
6298
 
6299
+ ### \_next()
6300
+
6301
+ ```ts
6302
+ protected _next(node): BSTNode<K, V> | undefined;
6303
+ ```
6304
+
6305
+ 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)
6306
+
6307
+ (Protected) Finds the in-order successor of a node.
6308
+
6309
+ #### Parameters
6310
+
6311
+ ##### node
6312
+
6313
+ [`BSTNode`](BSTNode.md)\<`K`, `V`\>
6314
+
6315
+ #### Returns
6316
+
6317
+ [`BSTNode`](BSTNode.md)\<`K`, `V`\> \| `undefined`
6318
+
6319
+ #### Remarks
6320
+
6321
+ Time O(log n), Space O(1)
6322
+
6323
+ #### Inherited from
6324
+
6325
+ [`BST`](BST.md).[`_next`](BST.md#_next)
6326
+
6327
+ ***
6328
+
5875
6329
  ### \_replaceNode()
5876
6330
 
5877
6331
  ```ts
5878
6332
  protected _replaceNode(oldNode, newNode): AVLTreeNode<K, V>;
5879
6333
  ```
5880
6334
 
5881
- Defined in: [data-structures/binary-tree/avl-tree.ts:1122](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/avl-tree.ts#L1122)
6335
+ Defined in: [data-structures/binary-tree/avl-tree.ts:1217](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/avl-tree.ts#L1217)
5882
6336
 
5883
6337
  (Protected) Replaces a node, ensuring height is copied.
5884
6338
 
@@ -5921,7 +6375,7 @@ protected _resolveDisplayLeaf(
5921
6375
  emptyDisplayLayout): NodeDisplayLayout;
5922
6376
  ```
5923
6377
 
5924
- 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)
6378
+ 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)
5925
6379
 
5926
6380
  Resolve a display leaf node to its layout.
5927
6381
 
@@ -5955,7 +6409,7 @@ Resolve a display leaf node to its layout.
5955
6409
  protected _setRoot(v): void;
5956
6410
  ```
5957
6411
 
5958
- 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)
6412
+ 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)
5959
6413
 
5960
6414
  (Protected) Sets the root node and clears its parent reference.
5961
6415
 
@@ -5987,7 +6441,7 @@ Time O(1)
5987
6441
  protected _setValue(key, value): boolean;
5988
6442
  ```
5989
6443
 
5990
- 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)
6444
+ 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)
5991
6445
 
5992
6446
  (Protected) Sets a value in the external store (Map mode).
5993
6447
 
@@ -6027,7 +6481,7 @@ Time O(1) (average for Map.set).
6027
6481
  protected _snapshotOptions<TK, TV, TR>(): BSTOptions<TK, TV, TR>;
6028
6482
  ```
6029
6483
 
6030
- 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)
6484
+ 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)
6031
6485
 
6032
6486
  (Protected) Snapshots the current BST's configuration options.
6033
6487
 
@@ -6067,7 +6521,7 @@ Time O(1)
6067
6521
  protected _swapProperties(srcNode, destNode): AVLTreeNode<K, V> | undefined;
6068
6522
  ```
6069
6523
 
6070
- Defined in: [data-structures/binary-tree/avl-tree.ts:836](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/avl-tree.ts#L836)
6524
+ Defined in: [data-structures/binary-tree/avl-tree.ts:920](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/avl-tree.ts#L920)
6071
6525
 
6072
6526
  (Protected) Swaps properties of two nodes, including height.
6073
6527
 
@@ -6101,13 +6555,73 @@ Time O(H) (due to `ensureNode`), but O(1) if nodes are passed directly.
6101
6555
 
6102
6556
  ***
6103
6557
 
6558
+ ### \_updateCount()
6559
+
6560
+ ```ts
6561
+ protected _updateCount(node): void;
6562
+ ```
6563
+
6564
+ 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)
6565
+
6566
+ (Protected) Recalculates the subtree count for a single node.
6567
+
6568
+ #### Parameters
6569
+
6570
+ ##### node
6571
+
6572
+ [`BSTNode`](BSTNode.md)\<`K`, `V`\>
6573
+
6574
+ #### Returns
6575
+
6576
+ `void`
6577
+
6578
+ #### Remarks
6579
+
6580
+ Time O(1). Only active when enableOrderStatistic is true.
6581
+
6582
+ #### Inherited from
6583
+
6584
+ [`BST`](BST.md).[`_updateCount`](BST.md#_updatecount)
6585
+
6586
+ ***
6587
+
6588
+ ### \_updateCountAlongPath()
6589
+
6590
+ ```ts
6591
+ protected _updateCountAlongPath(node): void;
6592
+ ```
6593
+
6594
+ 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)
6595
+
6596
+ (Protected) Updates subtree counts from a node up to the root.
6597
+
6598
+ #### Parameters
6599
+
6600
+ ##### node
6601
+
6602
+ `OptNode`\<[`BSTNode`](BSTNode.md)\<`K`, `V`\>\>
6603
+
6604
+ #### Returns
6605
+
6606
+ `void`
6607
+
6608
+ #### Remarks
6609
+
6610
+ Time O(log n). Only active when enableOrderStatistic is true.
6611
+
6612
+ #### Inherited from
6613
+
6614
+ [`BST`](BST.md).[`_updateCountAlongPath`](BST.md#_updatecountalongpath)
6615
+
6616
+ ***
6617
+
6104
6618
  ### \_updateHeight()
6105
6619
 
6106
6620
  ```ts
6107
6621
  protected _updateHeight(node): void;
6108
6622
  ```
6109
6623
 
6110
- Defined in: [data-structures/binary-tree/avl-tree.ts:886](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/binary-tree/avl-tree.ts#L886)
6624
+ Defined in: [data-structures/binary-tree/avl-tree.ts:970](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/avl-tree.ts#L970)
6111
6625
 
6112
6626
  (Protected) Recalculates and updates the height of a node based on its children's heights.
6113
6627