data-structure-typed 2.5.2 → 2.5.3

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 (156) hide show
  1. package/CHANGELOG.md +3 -1
  2. package/MIGRATION.md +169 -0
  3. package/README.md +60 -6
  4. package/README_CN.md +551 -143
  5. package/SPECIFICATION.md +20 -14
  6. package/SPECIFICATION.zh-CN.md +20 -14
  7. package/dist/cjs/binary-tree.cjs +2417 -132
  8. package/dist/cjs/graph.cjs +248 -14
  9. package/dist/cjs/hash.cjs +62 -7
  10. package/dist/cjs/heap.cjs +103 -16
  11. package/dist/cjs/index.cjs +3046 -124
  12. package/dist/cjs/linked-list.cjs +219 -0
  13. package/dist/cjs/matrix.cjs +32 -0
  14. package/dist/cjs/priority-queue.cjs +101 -14
  15. package/dist/cjs/queue.cjs +215 -0
  16. package/dist/cjs/stack.cjs +44 -4
  17. package/dist/cjs/trie.cjs +44 -0
  18. package/dist/cjs-legacy/binary-tree.cjs +2406 -123
  19. package/dist/cjs-legacy/graph.cjs +248 -14
  20. package/dist/cjs-legacy/hash.cjs +62 -7
  21. package/dist/cjs-legacy/heap.cjs +103 -16
  22. package/dist/cjs-legacy/index.cjs +3105 -185
  23. package/dist/cjs-legacy/linked-list.cjs +219 -0
  24. package/dist/cjs-legacy/matrix.cjs +32 -0
  25. package/dist/cjs-legacy/priority-queue.cjs +101 -14
  26. package/dist/cjs-legacy/queue.cjs +215 -0
  27. package/dist/cjs-legacy/stack.cjs +44 -4
  28. package/dist/cjs-legacy/trie.cjs +44 -0
  29. package/dist/esm/binary-tree.mjs +2417 -132
  30. package/dist/esm/graph.mjs +248 -14
  31. package/dist/esm/hash.mjs +62 -7
  32. package/dist/esm/heap.mjs +103 -16
  33. package/dist/esm/index.mjs +3046 -124
  34. package/dist/esm/linked-list.mjs +219 -0
  35. package/dist/esm/matrix.mjs +32 -0
  36. package/dist/esm/priority-queue.mjs +101 -14
  37. package/dist/esm/queue.mjs +215 -0
  38. package/dist/esm/stack.mjs +44 -4
  39. package/dist/esm/trie.mjs +44 -0
  40. package/dist/esm-legacy/binary-tree.mjs +2406 -123
  41. package/dist/esm-legacy/graph.mjs +248 -14
  42. package/dist/esm-legacy/hash.mjs +62 -7
  43. package/dist/esm-legacy/heap.mjs +103 -16
  44. package/dist/esm-legacy/index.mjs +3105 -185
  45. package/dist/esm-legacy/linked-list.mjs +219 -0
  46. package/dist/esm-legacy/matrix.mjs +32 -0
  47. package/dist/esm-legacy/priority-queue.mjs +101 -14
  48. package/dist/esm-legacy/queue.mjs +215 -0
  49. package/dist/esm-legacy/stack.mjs +44 -4
  50. package/dist/esm-legacy/trie.mjs +44 -0
  51. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +50 -2
  52. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +56 -0
  53. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +116 -15
  54. package/dist/types/data-structures/binary-tree/bst.d.ts +99 -3
  55. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +79 -8
  56. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +24 -0
  57. package/dist/types/data-structures/binary-tree/tree-map.d.ts +520 -1
  58. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +489 -1
  59. package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +393 -1
  60. package/dist/types/data-structures/binary-tree/tree-set.d.ts +500 -1
  61. package/dist/types/data-structures/graph/directed-graph.d.ts +40 -0
  62. package/dist/types/data-structures/graph/undirected-graph.d.ts +36 -0
  63. package/dist/types/data-structures/hash/hash-map.d.ts +51 -6
  64. package/dist/types/data-structures/heap/heap.d.ts +98 -12
  65. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +75 -0
  66. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +61 -1
  67. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +72 -0
  68. package/dist/types/data-structures/matrix/matrix.d.ts +32 -0
  69. package/dist/types/data-structures/queue/deque.d.ts +82 -0
  70. package/dist/types/data-structures/queue/queue.d.ts +61 -0
  71. package/dist/types/data-structures/stack/stack.d.ts +42 -2
  72. package/dist/types/data-structures/trie/trie.d.ts +48 -0
  73. package/dist/types/interfaces/binary-tree.d.ts +2 -3
  74. package/dist/umd/data-structure-typed.js +3105 -185
  75. package/dist/umd/data-structure-typed.min.js +4 -4
  76. package/docs-site-docusaurus/docs/api/classes/AVLTree.md +188 -200
  77. package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +11 -11
  78. package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +62 -62
  79. package/docs-site-docusaurus/docs/api/classes/BST.md +183 -195
  80. package/docs-site-docusaurus/docs/api/classes/BSTNode.md +13 -13
  81. package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +15 -15
  82. package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +143 -155
  83. package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +13 -13
  84. package/docs-site-docusaurus/docs/api/classes/Deque.md +99 -85
  85. package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +73 -73
  86. package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +100 -70
  87. package/docs-site-docusaurus/docs/api/classes/DoublyLinkedListNode.md +8 -8
  88. package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +12 -12
  89. package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +1 -1
  90. package/docs-site-docusaurus/docs/api/classes/HashMap.md +38 -38
  91. package/docs-site-docusaurus/docs/api/classes/Heap.md +96 -85
  92. package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +25 -25
  93. package/docs-site-docusaurus/docs/api/classes/IterableEntryBase.md +23 -23
  94. package/docs-site-docusaurus/docs/api/classes/LinearBase.md +48 -48
  95. package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +52 -52
  96. package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +42 -42
  97. package/docs-site-docusaurus/docs/api/classes/LinkedListNode.md +6 -6
  98. package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +74 -74
  99. package/docs-site-docusaurus/docs/api/classes/MapGraph.md +73 -73
  100. package/docs-site-docusaurus/docs/api/classes/Matrix.md +31 -31
  101. package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +104 -89
  102. package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +104 -89
  103. package/docs-site-docusaurus/docs/api/classes/MinHeap.md +104 -89
  104. package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +104 -89
  105. package/docs-site-docusaurus/docs/api/classes/Navigator.md +5 -5
  106. package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +103 -88
  107. package/docs-site-docusaurus/docs/api/classes/Queue.md +111 -59
  108. package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +200 -212
  109. package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +10 -10
  110. package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +75 -75
  111. package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +6 -6
  112. package/docs-site-docusaurus/docs/api/classes/SkipList.md +37 -37
  113. package/docs-site-docusaurus/docs/api/classes/Stack.md +42 -42
  114. package/docs-site-docusaurus/docs/api/classes/TreeMap.md +107 -36
  115. package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +43 -43
  116. package/docs-site-docusaurus/docs/api/classes/TreeSet.md +106 -35
  117. package/docs-site-docusaurus/docs/api/classes/Trie.md +43 -43
  118. package/docs-site-docusaurus/docs/api/classes/TrieNode.md +8 -8
  119. package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +72 -72
  120. package/docs-site-docusaurus/docs/guide/architecture.md +75 -7
  121. package/docs-site-docusaurus/docs/guide/concepts.md +53 -34
  122. package/docs-site-docusaurus/docs/guide/faq.md +53 -0
  123. package/docs-site-docusaurus/docs/guide/guides.md +8 -9
  124. package/docs-site-docusaurus/docs/guide/integrations.md +74 -177
  125. package/docs-site-docusaurus/docs/guide/overview.md +131 -17
  126. package/docs-site-docusaurus/src/pages/index.tsx +4 -0
  127. package/docs-site-docusaurus/typedoc.json +1 -0
  128. package/package.json +7 -6
  129. package/src/data-structures/binary-tree/avl-tree.ts +52 -5
  130. package/src/data-structures/binary-tree/binary-indexed-tree.ts +56 -0
  131. package/src/data-structures/binary-tree/binary-tree.ts +167 -81
  132. package/src/data-structures/binary-tree/bst.ts +101 -7
  133. package/src/data-structures/binary-tree/red-black-tree.ts +82 -15
  134. package/src/data-structures/binary-tree/segment-tree.ts +24 -0
  135. package/src/data-structures/binary-tree/tree-map.ts +540 -3
  136. package/src/data-structures/binary-tree/tree-multi-map.ts +490 -2
  137. package/src/data-structures/binary-tree/tree-multi-set.ts +393 -1
  138. package/src/data-structures/binary-tree/tree-set.ts +520 -3
  139. package/src/data-structures/graph/directed-graph.ts +41 -1
  140. package/src/data-structures/graph/undirected-graph.ts +37 -1
  141. package/src/data-structures/hash/hash-map.ts +67 -12
  142. package/src/data-structures/heap/heap.ts +107 -19
  143. package/src/data-structures/linked-list/doubly-linked-list.ts +88 -0
  144. package/src/data-structures/linked-list/singly-linked-list.ts +61 -1
  145. package/src/data-structures/linked-list/skip-linked-list.ts +72 -0
  146. package/src/data-structures/matrix/matrix.ts +32 -0
  147. package/src/data-structures/queue/deque.ts +85 -0
  148. package/src/data-structures/queue/queue.ts +73 -0
  149. package/src/data-structures/stack/stack.ts +45 -5
  150. package/src/data-structures/trie/trie.ts +48 -0
  151. package/src/interfaces/binary-tree.ts +1 -9
  152. package/.vitepress/cache/deps_temp_51f5f1b0/chunk-7OIKW5WK.js +0 -12984
  153. package/.vitepress/cache/deps_temp_51f5f1b0/package.json +0 -3
  154. package/.vitepress/cache/deps_temp_51f5f1b0/vitepress___@vue_devtools-api.js +0 -4505
  155. package/.vitepress/cache/deps_temp_51f5f1b0/vitepress___@vueuse_core.js +0 -9731
  156. package/.vitepress/cache/deps_temp_51f5f1b0/vue.js +0 -347
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Class: BST\<K, V, R\>
8
8
 
9
- Defined in: [data-structures/binary-tree/bst.ts:327](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L327)
9
+ Defined in: [data-structures/binary-tree/bst.ts:326](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L326)
10
10
 
11
11
  Represents a Binary Search Tree (BST).
12
12
  Keys are ordered, allowing for faster search operations compared to a standard Binary Tree.
@@ -188,7 +188,7 @@ The type of the raw data object (if using `toEntryFn`).
188
188
  new BST<K, V, R>(keysNodesEntriesOrRaws?, options?): BST<K, V, R>;
189
189
  ```
190
190
 
191
- Defined in: [data-structures/binary-tree/bst.ts:335](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L335)
191
+ Defined in: [data-structures/binary-tree/bst.ts:334](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L334)
192
192
 
193
193
  Creates an instance of BST.
194
194
 
@@ -234,7 +234,7 @@ Time O(N log N) or O(N^2) depending on `isBalanceAdd` in `addMany` and input ord
234
234
  get comparator(): Comparator<K>;
235
235
  ```
236
236
 
237
- Defined in: [data-structures/binary-tree/bst.ts:385](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L385)
237
+ Defined in: [data-structures/binary-tree/bst.ts:384](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L384)
238
238
 
239
239
  Gets the comparator function used by the tree.
240
240
 
@@ -258,7 +258,7 @@ The comparator function.
258
258
  get isDuplicate(): boolean;
259
259
  ```
260
260
 
261
- Defined in: [data-structures/binary-tree/binary-tree.ts:322](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L322)
261
+ Defined in: [data-structures/binary-tree/binary-tree.ts:322](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L322)
262
262
 
263
263
  Gets whether the tree allows duplicate keys.
264
264
 
@@ -292,7 +292,7 @@ IBinaryTree.isDuplicate
292
292
  get isMapMode(): boolean;
293
293
  ```
294
294
 
295
- Defined in: [data-structures/binary-tree/binary-tree.ts:310](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L310)
295
+ Defined in: [data-structures/binary-tree/binary-tree.ts:310](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L310)
296
296
 
297
297
  Gets whether the tree is in Map mode.
298
298
 
@@ -326,7 +326,7 @@ IBinaryTree.isMapMode
326
326
  get NIL(): BinaryTreeNode<K, V>;
327
327
  ```
328
328
 
329
- Defined in: [data-structures/binary-tree/binary-tree.ts:373](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L373)
329
+ Defined in: [data-structures/binary-tree/binary-tree.ts:373](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L373)
330
330
 
331
331
  Gets the sentinel NIL node (used in self-balancing trees like Red-Black Tree).
332
332
 
@@ -360,7 +360,7 @@ IBinaryTree.NIL
360
360
  get root(): OptNode<BSTNode<K, V>>;
361
361
  ```
362
362
 
363
- Defined in: [data-structures/binary-tree/bst.ts:368](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L368)
363
+ Defined in: [data-structures/binary-tree/bst.ts:367](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L367)
364
364
 
365
365
  Gets the root node of the tree.
366
366
 
@@ -394,7 +394,7 @@ IBinaryTree.root
394
394
  get size(): number;
395
395
  ```
396
396
 
397
- Defined in: [data-structures/binary-tree/binary-tree.ts:361](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L361)
397
+ Defined in: [data-structures/binary-tree/binary-tree.ts:361](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L361)
398
398
 
399
399
  Gets the number of nodes in the tree.
400
400
 
@@ -428,7 +428,7 @@ IBinaryTree.size
428
428
  get store(): Map<K, BinaryTreeNode<K, V>>;
429
429
  ```
430
430
 
431
- Defined in: [data-structures/binary-tree/binary-tree.ts:337](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L337)
431
+ Defined in: [data-structures/binary-tree/binary-tree.ts:337](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L337)
432
432
 
433
433
  Gets the external value store (used in Map mode).
434
434
 
@@ -462,7 +462,7 @@ IBinaryTree.store
462
462
  get toEntryFn(): ToEntryFn<K, V, R> | undefined;
463
463
  ```
464
464
 
465
- Defined in: [data-structures/binary-tree/binary-tree.ts:385](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L385)
465
+ Defined in: [data-structures/binary-tree/binary-tree.ts:385](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L385)
466
466
 
467
467
  Gets the function used to convert raw data objects (R) into [key, value] entries.
468
468
 
@@ -494,7 +494,7 @@ IBinaryTree.toEntryFn
494
494
  iterator: IterableIterator<[K, V | undefined]>;
495
495
  ```
496
496
 
497
- Defined in: [data-structures/base/iterable-entry-base.ts:22](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L22)
497
+ Defined in: [data-structures/base/iterable-entry-base.ts:22](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-entry-base.ts#L22)
498
498
 
499
499
  Default iterator yielding `[key, value]` entries.
500
500
 
@@ -532,7 +532,7 @@ IBinaryTree.[iterator]
532
532
  add(keyNodeOrEntry): boolean;
533
533
  ```
534
534
 
535
- Defined in: [data-structures/binary-tree/binary-tree.ts:608](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L608)
535
+ Defined in: [data-structures/binary-tree/binary-tree.ts:612](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L612)
536
536
 
537
537
  Adds a new node to the tree.
538
538
 
@@ -558,7 +558,7 @@ True if the addition was successful, false otherwise.
558
558
 
559
559
  #### Remarks
560
560
 
561
- Time O(log N), For BST, Red-Black Tree, and AVL Tree subclasses, the worst-case time is O(log N). This implementation adds the node at the first available position in a level-order (BFS) traversal. This is NOT a Binary Search Tree insertion. Time O(N), where N is the number of nodes. It must traverse level-by-level to find an empty slot. Space O(N) in the worst case for the BFS queue (e.g., a full last level).
561
+ Time O(N) level-order traversal to find an empty slot. Space O(N) for the BFS queue. BST/Red-Black Tree/AVL Tree subclasses override to O(log N).
562
562
 
563
563
  #### Example
564
564
 
@@ -590,7 +590,7 @@ IBinaryTree.add
590
590
  addMany(keysNodesEntriesOrRaws): boolean[];
591
591
  ```
592
592
 
593
- Defined in: [data-structures/binary-tree/binary-tree.ts:781](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L781)
593
+ Defined in: [data-structures/binary-tree/binary-tree.ts:793](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L793)
594
594
 
595
595
  Adds multiple items to the tree.
596
596
 
@@ -671,7 +671,7 @@ The traversal method.
671
671
  bfs(): (K | undefined)[];
672
672
  ```
673
673
 
674
- Defined in: [data-structures/binary-tree/bst.ts:620](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L620)
674
+ Defined in: [data-structures/binary-tree/bst.ts:635](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L635)
675
675
 
676
676
  BinaryTree level-order traversal
677
677
 
@@ -709,7 +709,7 @@ bfs<C>(
709
709
  iterationType?): ReturnType<C>[];
710
710
  ```
711
711
 
712
- Defined in: [data-structures/binary-tree/bst.ts:621](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L621)
712
+ Defined in: [data-structures/binary-tree/bst.ts:636](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L636)
713
713
 
714
714
  BinaryTree level-order traversal
715
715
 
@@ -771,7 +771,7 @@ IBinaryTree.bfs
771
771
  ceiling(keyNodeEntryOrPredicate): K | undefined;
772
772
  ```
773
773
 
774
- Defined in: [data-structures/binary-tree/bst.ts:1782](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1782)
774
+ Defined in: [data-structures/binary-tree/bst.ts:1849](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1849)
775
775
 
776
776
  Returns the first key with a value >= target.
777
777
  Equivalent to Java TreeMap.ceiling.
@@ -814,7 +814,7 @@ ceiling<C>(
814
814
  iterationType?): ReturnType<C>;
815
815
  ```
816
816
 
817
- Defined in: [data-structures/binary-tree/bst.ts:1797](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1797)
817
+ Defined in: [data-structures/binary-tree/bst.ts:1864](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1864)
818
818
 
819
819
  Returns the first node with a key >= target and applies callback.
820
820
  Time Complexity: O(log n) average, O(h) worst case.
@@ -857,7 +857,7 @@ Space Complexity: O(h) for recursion, O(1) for iteration.
857
857
  clear(): void;
858
858
  ```
859
859
 
860
- Defined in: [data-structures/binary-tree/binary-tree.ts:1509](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1509)
860
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1543](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1543)
861
861
 
862
862
  Clears the tree of all nodes and values.
863
863
 
@@ -898,7 +898,7 @@ IBinaryTree.clear
898
898
  clone(): this;
899
899
  ```
900
900
 
901
- Defined in: [data-structures/binary-tree/binary-tree.ts:2697](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2697)
901
+ Defined in: [data-structures/binary-tree/binary-tree.ts:2771](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2771)
902
902
 
903
903
  Clones the tree.
904
904
 
@@ -942,7 +942,7 @@ IBinaryTree.clone
942
942
  createNode(key, value?): BSTNode<K, V>;
943
943
  ```
944
944
 
945
- Defined in: [data-structures/binary-tree/bst.ts:397](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L397)
945
+ Defined in: [data-structures/binary-tree/bst.ts:396](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L396)
946
946
 
947
947
  (Protected) Creates a new BST node.
948
948
 
@@ -988,7 +988,7 @@ IBinaryTree.createNode
988
988
  createTree(options?): this;
989
989
  ```
990
990
 
991
- Defined in: [data-structures/binary-tree/binary-tree.ts:408](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L408)
991
+ Defined in: [data-structures/binary-tree/binary-tree.ts:408](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L408)
992
992
 
993
993
  Creates a new, empty tree of the same type and configuration.
994
994
 
@@ -1025,10 +1025,10 @@ IBinaryTree.createTree
1025
1025
  ### delete()
1026
1026
 
1027
1027
  ```ts
1028
- delete(keyNodeEntryRawOrPredicate): BinaryTreeDeleteResult<BinaryTreeNode<K, V>>[];
1028
+ delete(keyNodeEntryRawOrPredicate): boolean;
1029
1029
  ```
1030
1030
 
1031
- Defined in: [data-structures/binary-tree/binary-tree.ts:971](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L971)
1031
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1039](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1039)
1032
1032
 
1033
1033
  Deletes a node from the tree.
1034
1034
 
@@ -1043,15 +1043,15 @@ The node to delete.
1043
1043
 
1044
1044
  #### Returns
1045
1045
 
1046
- `BinaryTreeDeleteResult`\<[`BinaryTreeNode`](BinaryTreeNode.md)\<`K`, `V`\>\>[]
1046
+ `boolean`
1047
1047
 
1048
- An array containing deletion results (for compatibility with self-balancing trees).
1048
+ True if the node was found and deleted, false otherwise.
1049
1049
 
1050
1050
  *
1051
1051
 
1052
1052
  #### Remarks
1053
1053
 
1054
- Time O(log N), For BST, Red-Black Tree, and AVL Tree subclasses, the worst-case time is O(log N). This implementation finds the node, and if it has two children, swaps it with the rightmost node of its left subtree (in-order predecessor) before deleting. Time O(N) in the worst case. O(N) to find the node (`getNode`) and O(H) (which is O(N) worst-case) to find the rightmost node. Space O(1) (if `getNode` is iterative, which it is).
1054
+ Time O(N) O(N) to find the node + O(H) for predecessor swap. Space O(1). BST/Red-Black Tree/AVL Tree subclasses override to O(log N).
1055
1055
 
1056
1056
  #### Example
1057
1057
 
@@ -1082,10 +1082,10 @@ deleteWhere(
1082
1082
  keyNodeEntryOrPredicate,
1083
1083
  onlyOne?,
1084
1084
  startNode?,
1085
- iterationType?): BinaryTreeDeleteResult<BSTNode<K, V>>[];
1085
+ iterationType?): boolean;
1086
1086
  ```
1087
1087
 
1088
- Defined in: [data-structures/binary-tree/bst.ts:2597](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2597)
1088
+ Defined in: [data-structures/binary-tree/bst.ts:2692](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2692)
1089
1089
 
1090
1090
  Deletes nodes that match a key, node, entry, predicate, or range.
1091
1091
 
@@ -1140,7 +1140,7 @@ Controls the internal traversal implementation:
1140
1140
 
1141
1141
  #### Returns
1142
1142
 
1143
- `BinaryTreeDeleteResult`\<[`BSTNode`](BSTNode.md)\<`K`, `V`\>\>[]
1143
+ `boolean`
1144
1144
 
1145
1145
  A Map<K, boolean> containing the deletion results:
1146
1146
  - Key: the matched node's key.
@@ -1192,7 +1192,7 @@ The traversal method.
1192
1192
  dfs(): (K | undefined)[];
1193
1193
  ```
1194
1194
 
1195
- Defined in: [data-structures/binary-tree/bst.ts:518](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L518)
1195
+ Defined in: [data-structures/binary-tree/bst.ts:525](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L525)
1196
1196
 
1197
1197
  Depth-first search traversal
1198
1198
 
@@ -1232,7 +1232,7 @@ dfs<C>(
1232
1232
  iterationType?): ReturnType<C>[];
1233
1233
  ```
1234
1234
 
1235
- Defined in: [data-structures/binary-tree/bst.ts:520](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L520)
1235
+ Defined in: [data-structures/binary-tree/bst.ts:527](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L527)
1236
1236
 
1237
1237
  Depth-first search traversal
1238
1238
 
@@ -1300,7 +1300,7 @@ IBinaryTree.dfs
1300
1300
  ensureNode(keyNodeOrEntry, iterationType?): OptNode<BSTNode<K, V>>;
1301
1301
  ```
1302
1302
 
1303
- Defined in: [data-structures/binary-tree/bst.ts:409](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L409)
1303
+ Defined in: [data-structures/binary-tree/bst.ts:408](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L408)
1304
1304
 
1305
1305
  Ensures the input is a node. If it's a key or entry, it searches for the node.
1306
1306
 
@@ -1344,7 +1344,7 @@ Time O(log N) (height of the tree), O(N) worst-case.
1344
1344
  entries(): IterableIterator<[K, V | undefined]>;
1345
1345
  ```
1346
1346
 
1347
- Defined in: [data-structures/base/iterable-entry-base.ts:31](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L31)
1347
+ Defined in: [data-structures/base/iterable-entry-base.ts:31](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-entry-base.ts#L31)
1348
1348
 
1349
1349
  Iterate over `[key, value]` pairs (may yield `undefined` values).
1350
1350
 
@@ -1376,7 +1376,7 @@ IBinaryTree.entries
1376
1376
  every(predicate, thisArg?): boolean;
1377
1377
  ```
1378
1378
 
1379
- Defined in: [data-structures/base/iterable-entry-base.ts:66](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L66)
1379
+ Defined in: [data-structures/base/iterable-entry-base.ts:66](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-entry-base.ts#L66)
1380
1380
 
1381
1381
  Test whether all entries satisfy the predicate.
1382
1382
 
@@ -1422,7 +1422,7 @@ IBinaryTree.every
1422
1422
  filter(predicate, thisArg?): this;
1423
1423
  ```
1424
1424
 
1425
- Defined in: [data-structures/binary-tree/binary-tree.ts:2749](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2749)
1425
+ Defined in: [data-structures/binary-tree/binary-tree.ts:2827](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2827)
1426
1426
 
1427
1427
  Creates a new tree containing only the entries that satisfy the predicate.
1428
1428
 
@@ -1479,7 +1479,7 @@ IBinaryTree.filter
1479
1479
  find(callbackfn, thisArg?): [K, V | undefined] | undefined;
1480
1480
  ```
1481
1481
 
1482
- Defined in: [data-structures/base/iterable-entry-base.ts:114](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L114)
1482
+ Defined in: [data-structures/base/iterable-entry-base.ts:114](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-entry-base.ts#L114)
1483
1483
 
1484
1484
  Find the first entry that matches a predicate.
1485
1485
 
@@ -1527,7 +1527,7 @@ IBinaryTree.find
1527
1527
  floor(keyNodeEntryOrPredicate): K | undefined;
1528
1528
  ```
1529
1529
 
1530
- Defined in: [data-structures/binary-tree/bst.ts:1993](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1993)
1530
+ Defined in: [data-structures/binary-tree/bst.ts:2068](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2068)
1531
1531
 
1532
1532
  Returns the first key with a value <= target.
1533
1533
  Equivalent to Java TreeMap.floor.
@@ -1570,7 +1570,7 @@ floor<C>(
1570
1570
  iterationType?): ReturnType<C>;
1571
1571
  ```
1572
1572
 
1573
- Defined in: [data-structures/binary-tree/bst.ts:2008](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2008)
1573
+ Defined in: [data-structures/binary-tree/bst.ts:2083](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2083)
1574
1574
 
1575
1575
  Returns the first node with a key <= target and applies callback.
1576
1576
  Time Complexity: O(log n) average, O(h) worst case.
@@ -1613,7 +1613,7 @@ Space Complexity: O(h) for recursion, O(1) for iteration.
1613
1613
  forEach(callbackfn, thisArg?): void;
1614
1614
  ```
1615
1615
 
1616
- Defined in: [data-structures/base/iterable-entry-base.ts:99](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L99)
1616
+ Defined in: [data-structures/base/iterable-entry-base.ts:99](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-entry-base.ts#L99)
1617
1617
 
1618
1618
  Visit each entry, left-to-right.
1619
1619
 
@@ -1660,7 +1660,7 @@ get(
1660
1660
  iterationType?): V | undefined;
1661
1661
  ```
1662
1662
 
1663
- Defined in: [data-structures/binary-tree/binary-tree.ts:1349](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1349)
1663
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1375](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1375)
1664
1664
 
1665
1665
  Gets the value associated with a key.
1666
1666
 
@@ -1701,7 +1701,7 @@ The associated value, or undefined.
1701
1701
 
1702
1702
  #### Remarks
1703
1703
 
1704
- Time O(log N), For BST, Red-Black Tree, and AVL Tree subclasses, the worst-case time is O(log N). Time O(1) if in Map mode. O(N) if not in Map mode (uses `getNode`). Space O(1) if in Map mode. O(H) or O(N) otherwise.
1704
+ Time O(1) in Map mode, O(N) otherwise (via `getNode`). Space O(1) in Map mode, O(H) or O(N) otherwise. BST subclasses override non-Map-mode to O(log N).
1705
1705
 
1706
1706
  #### Example
1707
1707
 
@@ -1732,7 +1732,7 @@ IBinaryTree.get
1732
1732
  getByRank(k): K | undefined;
1733
1733
  ```
1734
1734
 
1735
- Defined in: [data-structures/binary-tree/bst.ts:1197](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1197)
1735
+ Defined in: [data-structures/binary-tree/bst.ts:1240](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1240)
1736
1736
 
1737
1737
  Returns the element at the k-th position in tree order (0-indexed).
1738
1738
 
@@ -1775,7 +1775,7 @@ getByRank<C>(
1775
1775
  iterationType?): ReturnType<C> | undefined;
1776
1776
  ```
1777
1777
 
1778
- Defined in: [data-structures/binary-tree/bst.ts:1208](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1208)
1778
+ Defined in: [data-structures/binary-tree/bst.ts:1251](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1251)
1779
1779
 
1780
1780
  Returns the element at the k-th position in tree order and applies a callback.
1781
1781
 
@@ -1823,7 +1823,7 @@ Time O(log n), Space O(1) iterative / O(log n) recursive. Requires `enableOrderS
1823
1823
  getDepth(dist, startNode?): number;
1824
1824
  ```
1825
1825
 
1826
- Defined in: [data-structures/binary-tree/binary-tree.ts:1710](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1710)
1826
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1756](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1756)
1827
1827
 
1828
1828
  Gets the depth of a node (distance from `startNode`).
1829
1829
 
@@ -1887,7 +1887,7 @@ IBinaryTree.getDepth
1887
1887
  getHeight(startNode?, iterationType?): number;
1888
1888
  ```
1889
1889
 
1890
- Defined in: [data-structures/binary-tree/binary-tree.ts:1774](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1774)
1890
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1824](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1824)
1891
1891
 
1892
1892
  Gets the maximum height of the tree (longest path from startNode to a leaf).
1893
1893
 
@@ -1970,7 +1970,7 @@ The traversal method.
1970
1970
  getLeftMost(): K | undefined;
1971
1971
  ```
1972
1972
 
1973
- Defined in: [data-structures/binary-tree/binary-tree.ts:1901](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1901)
1973
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1951](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1951)
1974
1974
 
1975
1975
  ##### Returns
1976
1976
 
@@ -1995,7 +1995,7 @@ getLeftMost<C>(
1995
1995
  iterationType?): ReturnType<C>;
1996
1996
  ```
1997
1997
 
1998
- Defined in: [data-structures/binary-tree/binary-tree.ts:1903](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1903)
1998
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1953](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1953)
1999
1999
 
2000
2000
  ##### Type Parameters
2001
2001
 
@@ -2042,7 +2042,7 @@ IBinaryTree.getLeftMost
2042
2042
  getMinHeight(startNode?, iterationType?): number;
2043
2043
  ```
2044
2044
 
2045
- Defined in: [data-structures/binary-tree/binary-tree.ts:1816](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1816)
2045
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1866](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1866)
2046
2046
 
2047
2047
  Gets the minimum height of the tree (shortest path from startNode to a leaf).
2048
2048
 
@@ -2094,7 +2094,7 @@ getNode(
2094
2094
  iterationType?): OptNode<BSTNode<K, V>>;
2095
2095
  ```
2096
2096
 
2097
- Defined in: [data-structures/binary-tree/bst.ts:829](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L829)
2097
+ Defined in: [data-structures/binary-tree/bst.ts:860](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L860)
2098
2098
 
2099
2099
  Gets the first node matching a predicate.
2100
2100
 
@@ -2167,7 +2167,7 @@ getNodes(
2167
2167
  iterationType?): BinaryTreeNode<K, V>[];
2168
2168
  ```
2169
2169
 
2170
- Defined in: [data-structures/binary-tree/binary-tree.ts:1205](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1205)
2170
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1223](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1223)
2171
2171
 
2172
2172
  Gets all nodes matching a predicate.
2173
2173
 
@@ -2262,7 +2262,7 @@ If true, returns the path from root-to-node.
2262
2262
  getPathToRoot(beginNode): (K | undefined)[];
2263
2263
  ```
2264
2264
 
2265
- Defined in: [data-structures/binary-tree/binary-tree.ts:1863](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1863)
2265
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1913](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1913)
2266
2266
 
2267
2267
  ##### Parameters
2268
2268
 
@@ -2297,7 +2297,7 @@ getPathToRoot<C>(
2297
2297
  isReverse?): ReturnType<C>[];
2298
2298
  ```
2299
2299
 
2300
- Defined in: [data-structures/binary-tree/binary-tree.ts:1867](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1867)
2300
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1917](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1917)
2301
2301
 
2302
2302
  ##### Type Parameters
2303
2303
 
@@ -2345,7 +2345,7 @@ IBinaryTree.getPathToRoot
2345
2345
  getPredecessor(node): BinaryTreeNode<K, V>;
2346
2346
  ```
2347
2347
 
2348
- Defined in: [data-structures/binary-tree/binary-tree.ts:2001](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2001)
2348
+ Defined in: [data-structures/binary-tree/binary-tree.ts:2051](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2051)
2349
2349
 
2350
2350
  Gets the Morris traversal predecessor (rightmost node in the left subtree, or node itself).
2351
2351
 
@@ -2381,7 +2381,7 @@ This is primarily a helper for Morris traversal. Time O(H), where H is the heigh
2381
2381
  getRank(keyNodeEntryOrPredicate): number;
2382
2382
  ```
2383
2383
 
2384
- Defined in: [data-structures/binary-tree/bst.ts:1252](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1252)
2384
+ Defined in: [data-structures/binary-tree/bst.ts:1295](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1295)
2385
2385
 
2386
2386
  Returns the 0-based rank of a key (number of elements that precede it in tree order).
2387
2387
 
@@ -2415,7 +2415,7 @@ Tree order is defined by the comparator. When the key is not found, returns the
2415
2415
  getRank(keyNodeEntryOrPredicate, iterationType): number;
2416
2416
  ```
2417
2417
 
2418
- Defined in: [data-structures/binary-tree/bst.ts:1270](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1270)
2418
+ Defined in: [data-structures/binary-tree/bst.ts:1313](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1313)
2419
2419
 
2420
2420
  Returns the 0-based rank (number of preceding elements in tree order) with explicit iteration type.
2421
2421
 
@@ -2480,7 +2480,7 @@ The traversal method.
2480
2480
  getRightMost(): K | undefined;
2481
2481
  ```
2482
2482
 
2483
- Defined in: [data-structures/binary-tree/binary-tree.ts:1948](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1948)
2483
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1998](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1998)
2484
2484
 
2485
2485
  ##### Returns
2486
2486
 
@@ -2505,7 +2505,7 @@ getRightMost<C>(
2505
2505
  iterationType?): ReturnType<C>;
2506
2506
  ```
2507
2507
 
2508
- Defined in: [data-structures/binary-tree/binary-tree.ts:1950](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1950)
2508
+ Defined in: [data-structures/binary-tree/binary-tree.ts:2000](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2000)
2509
2509
 
2510
2510
  ##### Type Parameters
2511
2511
 
@@ -2552,7 +2552,7 @@ IBinaryTree.getRightMost
2552
2552
  getSuccessor(x?): BinaryTreeNode<K, V> | null | undefined;
2553
2553
  ```
2554
2554
 
2555
- Defined in: [data-structures/binary-tree/binary-tree.ts:2022](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2022)
2555
+ Defined in: [data-structures/binary-tree/binary-tree.ts:2072](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2072)
2556
2556
 
2557
2557
  Gets the in-order successor of a node in a BST.
2558
2558
 
@@ -2589,7 +2589,7 @@ has(
2589
2589
  iterationType?): boolean;
2590
2590
  ```
2591
2591
 
2592
- Defined in: [data-structures/binary-tree/binary-tree.ts:1434](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1434)
2592
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1464](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1464)
2593
2593
 
2594
2594
  Checks if a node matching the predicate exists in the tree.
2595
2595
 
@@ -2630,7 +2630,7 @@ True if a matching node exists, false otherwise.
2630
2630
 
2631
2631
  #### Remarks
2632
2632
 
2633
- Time O(log N), For BST, Red-Black Tree, and AVL Tree subclasses, the worst-case time is O(log N). Time O(N) in the worst case (via `search`). Space O(H) or O(N) (via `search`).
2633
+ Time O(N) via `search`. Space O(H) or O(N). BST/Red-Black Tree/AVL Tree subclasses override to O(log N) for key lookups.
2634
2634
 
2635
2635
  #### Example
2636
2636
 
@@ -2682,7 +2682,7 @@ IBinaryTree.has
2682
2682
  hasValue(value): boolean;
2683
2683
  ```
2684
2684
 
2685
- Defined in: [data-structures/base/iterable-entry-base.ts:143](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L143)
2685
+ Defined in: [data-structures/base/iterable-entry-base.ts:143](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-entry-base.ts#L143)
2686
2686
 
2687
2687
  Whether there exists an entry with the given value.
2688
2688
 
@@ -2724,7 +2724,7 @@ IBinaryTree.hasValue
2724
2724
  higher(keyNodeEntryOrPredicate): K | undefined;
2725
2725
  ```
2726
2726
 
2727
- Defined in: [data-structures/binary-tree/bst.ts:1887](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1887)
2727
+ Defined in: [data-structures/binary-tree/bst.ts:1958](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1958)
2728
2728
 
2729
2729
  Returns the first key with a value > target.
2730
2730
  Equivalent to Java TreeMap.higher.
@@ -2766,7 +2766,7 @@ higher<C>(
2766
2766
  iterationType?): ReturnType<C>;
2767
2767
  ```
2768
2768
 
2769
- Defined in: [data-structures/binary-tree/bst.ts:1902](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1902)
2769
+ Defined in: [data-structures/binary-tree/bst.ts:1973](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1973)
2770
2770
 
2771
2771
  Returns the first node with a key > target and applies callback.
2772
2772
  Time Complexity: O(log n) average, O(h) worst case.
@@ -2809,7 +2809,7 @@ Space Complexity: O(h) for recursion, O(1) for iteration.
2809
2809
  isAVLBalanced(iterationType?): boolean;
2810
2810
  ```
2811
2811
 
2812
- Defined in: [data-structures/binary-tree/bst.ts:2418](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2418)
2812
+ Defined in: [data-structures/binary-tree/bst.ts:2505](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2505)
2813
2813
 
2814
2814
  Checks if the tree meets the AVL balance condition (height difference <= 1).
2815
2815
 
@@ -2849,7 +2849,7 @@ Time O(N), as it must visit every node to compute height. Space O(log N) for rec
2849
2849
  isBST(startNode?, iterationType?): boolean;
2850
2850
  ```
2851
2851
 
2852
- Defined in: [data-structures/binary-tree/binary-tree.ts:1619](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1619)
2852
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1661](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1661)
2853
2853
 
2854
2854
  Checks if the tree is a valid Binary Search Tree (BST).
2855
2855
 
@@ -2909,7 +2909,7 @@ IBinaryTree.isBST
2909
2909
  isEmpty(): boolean;
2910
2910
  ```
2911
2911
 
2912
- Defined in: [data-structures/binary-tree/binary-tree.ts:1556](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1556)
2912
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1594](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1594)
2913
2913
 
2914
2914
  Checks if the tree is empty.
2915
2915
 
@@ -2950,7 +2950,7 @@ IBinaryTree.isEmpty
2950
2950
  isEntry(keyNodeOrEntry): keyNodeOrEntry is BTNEntry<K, V>;
2951
2951
  ```
2952
2952
 
2953
- Defined in: [data-structures/binary-tree/binary-tree.ts:545](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L545)
2953
+ Defined in: [data-structures/binary-tree/binary-tree.ts:545](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L545)
2954
2954
 
2955
2955
  Checks if the given item is a [key, value] entry pair.
2956
2956
 
@@ -2988,7 +2988,7 @@ Time O(1), Space O(1)
2988
2988
  isLeaf(keyNodeOrEntry): boolean;
2989
2989
  ```
2990
2990
 
2991
- Defined in: [data-structures/binary-tree/binary-tree.ts:531](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L531)
2991
+ Defined in: [data-structures/binary-tree/binary-tree.ts:531](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L531)
2992
2992
 
2993
2993
  Checks if a node is a leaf (has no real children).
2994
2994
 
@@ -3026,7 +3026,7 @@ Time O(N) if a key/entry is passed (due to `ensureNode`). O(1) if a node is pass
3026
3026
  isNIL(keyNodeOrEntry): boolean;
3027
3027
  ```
3028
3028
 
3029
- Defined in: [data-structures/binary-tree/binary-tree.ts:500](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L500)
3029
+ Defined in: [data-structures/binary-tree/binary-tree.ts:500](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L500)
3030
3030
 
3031
3031
  Checks if the given item is the sentinel NIL node.
3032
3032
 
@@ -3064,7 +3064,7 @@ Time O(1), Space O(1)
3064
3064
  isNode(keyNodeOrEntry): keyNodeOrEntry is BSTNode<K, V>;
3065
3065
  ```
3066
3066
 
3067
- Defined in: [data-structures/binary-tree/bst.ts:423](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L423)
3067
+ Defined in: [data-structures/binary-tree/bst.ts:422](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L422)
3068
3068
 
3069
3069
  Checks if the given item is a `BSTNode` instance.
3070
3070
 
@@ -3102,7 +3102,7 @@ Time O(1), Space O(1)
3102
3102
  isPerfectlyBalanced(startNode?): boolean;
3103
3103
  ```
3104
3104
 
3105
- Defined in: [data-structures/binary-tree/binary-tree.ts:1567](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L1567)
3105
+ Defined in: [data-structures/binary-tree/binary-tree.ts:1605](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L1605)
3106
3106
 
3107
3107
  Checks if the tree is perfectly balanced.
3108
3108
 
@@ -3145,7 +3145,7 @@ IBinaryTree.isPerfectlyBalanced
3145
3145
  isRange(keyNodeEntryOrPredicate): keyNodeEntryOrPredicate is Range<K>;
3146
3146
  ```
3147
3147
 
3148
- Defined in: [data-structures/binary-tree/binary-tree.ts:511](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L511)
3148
+ Defined in: [data-structures/binary-tree/binary-tree.ts:511](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L511)
3149
3149
 
3150
3150
  Checks if the given item is a `Range` object.
3151
3151
 
@@ -3185,7 +3185,7 @@ Time O(1), Space O(1)
3185
3185
  isRaw(keyNodeEntryOrRaw): keyNodeEntryOrRaw is R;
3186
3186
  ```
3187
3187
 
3188
- Defined in: [data-structures/binary-tree/binary-tree.ts:460](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L460)
3188
+ Defined in: [data-structures/binary-tree/binary-tree.ts:460](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L460)
3189
3189
 
3190
3190
  Checks if the given item is a raw data object (R) that needs conversion via `toEntryFn`.
3191
3191
 
@@ -3224,7 +3224,7 @@ Time O(1), Space O(1)
3224
3224
  isRealNode(keyNodeOrEntry): keyNodeOrEntry is BinaryTreeNode<K, V>;
3225
3225
  ```
3226
3226
 
3227
- Defined in: [data-structures/binary-tree/binary-tree.ts:473](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L473)
3227
+ Defined in: [data-structures/binary-tree/binary-tree.ts:473](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L473)
3228
3228
 
3229
3229
  Checks if the given item is a "real" node (i.e., not null, undefined, or NIL).
3230
3230
 
@@ -3262,7 +3262,7 @@ Time O(1), Space O(1)
3262
3262
  isRealNodeOrNull(keyNodeOrEntry): keyNodeOrEntry is BinaryTreeNode<K, V> | null;
3263
3263
  ```
3264
3264
 
3265
- Defined in: [data-structures/binary-tree/binary-tree.ts:487](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L487)
3265
+ Defined in: [data-structures/binary-tree/binary-tree.ts:487](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L487)
3266
3266
 
3267
3267
  Checks if the given item is either a "real" node or null.
3268
3268
 
@@ -3300,7 +3300,7 @@ Time O(1), Space O(1)
3300
3300
  isValidKey(key): key is K;
3301
3301
  ```
3302
3302
 
3303
- Defined in: [data-structures/binary-tree/bst.ts:436](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L436)
3303
+ Defined in: [data-structures/binary-tree/bst.ts:435](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L435)
3304
3304
 
3305
3305
  Checks if the given key is valid (comparable).
3306
3306
 
@@ -3334,7 +3334,7 @@ Time O(1)
3334
3334
  keys(): IterableIterator<K>;
3335
3335
  ```
3336
3336
 
3337
- Defined in: [data-structures/base/iterable-entry-base.ts:42](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L42)
3337
+ Defined in: [data-structures/base/iterable-entry-base.ts:42](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-entry-base.ts#L42)
3338
3338
 
3339
3339
  Iterate over keys only.
3340
3340
 
@@ -3390,7 +3390,7 @@ The traversal method.
3390
3390
  leaves(): (K | undefined)[];
3391
3391
  ```
3392
3392
 
3393
- Defined in: [data-structures/binary-tree/binary-tree.ts:2316](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2316)
3393
+ Defined in: [data-structures/binary-tree/binary-tree.ts:2378](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2378)
3394
3394
 
3395
3395
  Get leaf nodes
3396
3396
 
@@ -3428,7 +3428,7 @@ leaves<C>(
3428
3428
  iterationType?): ReturnType<C>[];
3429
3429
  ```
3430
3430
 
3431
- Defined in: [data-structures/binary-tree/binary-tree.ts:2318](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2318)
3431
+ Defined in: [data-structures/binary-tree/binary-tree.ts:2380](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2380)
3432
3432
 
3433
3433
  Get leaf nodes
3434
3434
 
@@ -3516,7 +3516,7 @@ The traversal method.
3516
3516
  lesserOrGreaterTraverse(): (K | undefined)[];
3517
3517
  ```
3518
3518
 
3519
- Defined in: [data-structures/binary-tree/bst.ts:2244](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2244)
3519
+ Defined in: [data-structures/binary-tree/bst.ts:2323](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2323)
3520
3520
 
3521
3521
  ##### Returns
3522
3522
 
@@ -3532,7 +3532,7 @@ lesserOrGreaterTraverse<C>(
3532
3532
  iterationType?): ReturnType<C>[];
3533
3533
  ```
3534
3534
 
3535
- Defined in: [data-structures/binary-tree/bst.ts:2246](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2246)
3535
+ Defined in: [data-structures/binary-tree/bst.ts:2325](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2325)
3536
3536
 
3537
3537
  ##### Type Parameters
3538
3538
 
@@ -3597,7 +3597,7 @@ The traversal method.
3597
3597
  listLevels(): (K | undefined)[][];
3598
3598
  ```
3599
3599
 
3600
- Defined in: [data-structures/binary-tree/bst.ts:721](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L721)
3600
+ Defined in: [data-structures/binary-tree/bst.ts:744](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L744)
3601
3601
 
3602
3602
  Level-order grouping
3603
3603
 
@@ -3613,7 +3613,7 @@ Level-order grouping
3613
3613
  // Level-order grouping
3614
3614
  const bst = new BST<number>([5, 3, 7, 1, 4]);
3615
3615
  const levels = bst.listLevels(node => node.key);
3616
- console.log(levels.length); // > 0;
3616
+ console.log(levels); // toBeInstanceOf;
3617
3617
  console.log(levels[0].length); // 1; // root level has 1 node
3618
3618
  const allKeys = levels.flat().sort((a, b) => a - b);
3619
3619
  console.log(allKeys); // [1, 3, 4, 5, 7];
@@ -3638,7 +3638,7 @@ listLevels<C>(
3638
3638
  iterationType?): ReturnType<C>[][];
3639
3639
  ```
3640
3640
 
3641
- Defined in: [data-structures/binary-tree/bst.ts:723](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L723)
3641
+ Defined in: [data-structures/binary-tree/bst.ts:746](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L746)
3642
3642
 
3643
3643
  Level-order grouping
3644
3644
 
@@ -3677,7 +3677,7 @@ Level-order grouping
3677
3677
  // Level-order grouping
3678
3678
  const bst = new BST<number>([5, 3, 7, 1, 4]);
3679
3679
  const levels = bst.listLevels(node => node.key);
3680
- console.log(levels.length); // > 0;
3680
+ console.log(levels); // toBeInstanceOf;
3681
3681
  console.log(levels[0].length); // 1; // root level has 1 node
3682
3682
  const allKeys = levels.flat().sort((a, b) => a - b);
3683
3683
  console.log(allKeys); // [1, 3, 4, 5, 7];
@@ -3703,7 +3703,7 @@ IBinaryTree.listLevels
3703
3703
  lower(keyNodeEntryOrPredicate): K | undefined;
3704
3704
  ```
3705
3705
 
3706
- Defined in: [data-structures/binary-tree/bst.ts:2141](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2141)
3706
+ Defined in: [data-structures/binary-tree/bst.ts:2220](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2220)
3707
3707
 
3708
3708
  Returns the first key with a value < target.
3709
3709
  Equivalent to Java TreeMap.lower.
@@ -3745,7 +3745,7 @@ lower<C>(
3745
3745
  iterationType?): ReturnType<C>;
3746
3746
  ```
3747
3747
 
3748
- Defined in: [data-structures/binary-tree/bst.ts:2156](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2156)
3748
+ Defined in: [data-structures/binary-tree/bst.ts:2235](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2235)
3749
3749
 
3750
3750
  Returns the first node with a key < target and applies callback.
3751
3751
  Time Complexity: O(log n) average, O(h) worst case.
@@ -3791,7 +3791,7 @@ map<MK, MV, MR>(
3791
3791
  thisArg?): BST<MK, MV, MR>;
3792
3792
  ```
3793
3793
 
3794
- Defined in: [data-structures/binary-tree/bst.ts:2547](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2547)
3794
+ Defined in: [data-structures/binary-tree/bst.ts:2642](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2642)
3795
3795
 
3796
3796
  Creates a new BST by mapping each [key, value] pair to a new entry.
3797
3797
 
@@ -3875,7 +3875,7 @@ IBinaryTree.map
3875
3875
  merge(anotherTree): void;
3876
3876
  ```
3877
3877
 
3878
- Defined in: [data-structures/binary-tree/binary-tree.ts:902](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L902)
3878
+ Defined in: [data-structures/binary-tree/binary-tree.ts:922](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L922)
3879
3879
 
3880
3880
  Merges another tree into this one by seting all its nodes.
3881
3881
 
@@ -3949,7 +3949,7 @@ The node to start from.
3949
3949
  morris(): (K | undefined)[];
3950
3950
  ```
3951
3951
 
3952
- Defined in: [data-structures/binary-tree/binary-tree.ts:2534](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2534)
3952
+ Defined in: [data-structures/binary-tree/binary-tree.ts:2604](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2604)
3953
3953
 
3954
3954
  Morris traversal (O(1) space)
3955
3955
 
@@ -3987,7 +3987,7 @@ morris<C>(
3987
3987
  startNode?): ReturnType<C>[];
3988
3988
  ```
3989
3989
 
3990
- Defined in: [data-structures/binary-tree/binary-tree.ts:2536](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2536)
3990
+ Defined in: [data-structures/binary-tree/binary-tree.ts:2606](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2606)
3991
3991
 
3992
3992
  Morris traversal (O(1) space)
3993
3993
 
@@ -4047,7 +4047,7 @@ IBinaryTree.morris
4047
4047
  perfectlyBalance(iterationType?): boolean;
4048
4048
  ```
4049
4049
 
4050
- Defined in: [data-structures/binary-tree/bst.ts:2349](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2349)
4050
+ Defined in: [data-structures/binary-tree/bst.ts:2432](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2432)
4051
4051
 
4052
4052
  Rebuilds the tree to be perfectly balanced.
4053
4053
 
@@ -4091,7 +4091,7 @@ Time O(N) (O(N) for DFS, O(N) for sorted build). Space O(N) for node array and r
4091
4091
  print(options?, startNode?): void;
4092
4092
  ```
4093
4093
 
4094
- Defined in: [data-structures/binary-tree/binary-tree.ts:2895](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2895)
4094
+ Defined in: [data-structures/binary-tree/binary-tree.ts:2981](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2981)
4095
4095
 
4096
4096
  Prints a visual representation of the tree to the console.
4097
4097
 
@@ -4144,7 +4144,7 @@ Time O(N) (via `toVisual`). Space O(N*H) or O(N^2) (via `toVisual`).
4144
4144
  rangeByRank(start, end): (K | undefined)[];
4145
4145
  ```
4146
4146
 
4147
- Defined in: [data-structures/binary-tree/bst.ts:1332](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1332)
4147
+ Defined in: [data-structures/binary-tree/bst.ts:1375](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1375)
4148
4148
 
4149
4149
  Returns elements by position range in tree order (0-indexed, inclusive on both ends).
4150
4150
 
@@ -4182,7 +4182,7 @@ rangeByRank<C>(
4182
4182
  iterationType?): ReturnType<C>[];
4183
4183
  ```
4184
4184
 
4185
- Defined in: [data-structures/binary-tree/bst.ts:1344](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1344)
4185
+ Defined in: [data-structures/binary-tree/bst.ts:1387](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1387)
4186
4186
 
4187
4187
  Returns elements by position range in tree order with callback and optional iteration type.
4188
4188
 
@@ -4264,7 +4264,7 @@ The traversal method.
4264
4264
  rangeSearch(range): (K | undefined)[];
4265
4265
  ```
4266
4266
 
4267
- Defined in: [data-structures/binary-tree/bst.ts:1151](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1151)
4267
+ Defined in: [data-structures/binary-tree/bst.ts:1194](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1194)
4268
4268
 
4269
4269
  Find all keys in a range
4270
4270
 
@@ -4298,7 +4298,7 @@ rangeSearch<C>(
4298
4298
  iterationType?): ReturnType<C>[];
4299
4299
  ```
4300
4300
 
4301
- Defined in: [data-structures/binary-tree/bst.ts:1153](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1153)
4301
+ Defined in: [data-structures/binary-tree/bst.ts:1196](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1196)
4302
4302
 
4303
4303
  Find all keys in a range
4304
4304
 
@@ -4351,7 +4351,7 @@ Find all keys in a range
4351
4351
  reduce<U>(callbackfn, initialValue): U;
4352
4352
  ```
4353
4353
 
4354
- Defined in: [data-structures/base/iterable-entry-base.ts:171](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L171)
4354
+ Defined in: [data-structures/base/iterable-entry-base.ts:171](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-entry-base.ts#L171)
4355
4355
 
4356
4356
  Reduce entries into a single accumulator.
4357
4357
 
@@ -4397,56 +4397,6 @@ IBinaryTree.reduce
4397
4397
 
4398
4398
  ***
4399
4399
 
4400
- ### refill()
4401
-
4402
- ```ts
4403
- refill(keysNodesEntriesOrRaws, values?): void;
4404
- ```
4405
-
4406
- Defined in: [data-structures/binary-tree/binary-tree.ts:913](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L913)
4407
-
4408
- Clears the tree and refills it with new items.
4409
-
4410
- #### Parameters
4411
-
4412
- ##### keysNodesEntriesOrRaws
4413
-
4414
- `Iterable`\<
4415
- \| `K`
4416
- \| `R`
4417
- \| [`BinaryTreeNode`](BinaryTreeNode.md)\<`K`, `V`\>
4418
- \| \[`K` \| `null` \| `undefined`, `V` \| `undefined`\]
4419
- \| `null`
4420
- \| `undefined`\>
4421
-
4422
- An iterable of items to set.
4423
-
4424
- ##### values?
4425
-
4426
- `Iterable`\<`V` \| `undefined`, `any`, `any`\>
4427
-
4428
- An optional parallel iterable of values.
4429
-
4430
- #### Returns
4431
-
4432
- `void`
4433
-
4434
- #### Remarks
4435
-
4436
- Time O(N) (for `clear`) + O(N * M) (for `setMany`) = O(N * M). Space O(M) (from `setMany`).
4437
-
4438
- #### Implementation of
4439
-
4440
- ```ts
4441
- IBinaryTree.refill
4442
- ```
4443
-
4444
- #### Inherited from
4445
-
4446
- [`BinaryTree`](BinaryTree.md).[`refill`](BinaryTree.md#refill)
4447
-
4448
- ***
4449
-
4450
4400
  ### search()
4451
4401
 
4452
4402
  Searches the tree for nodes matching a predicate, key, or range.
@@ -4487,7 +4437,7 @@ Whether to use 'RECURSIVE' or 'ITERATIVE' search.
4487
4437
  search(keyNodeEntryOrPredicate, onlyOne?): (K | undefined)[];
4488
4438
  ```
4489
4439
 
4490
- Defined in: [data-structures/binary-tree/bst.ts:957](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L957)
4440
+ Defined in: [data-structures/binary-tree/bst.ts:996](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L996)
4491
4441
 
4492
4442
  Search nodes by predicate
4493
4443
 
@@ -4543,7 +4493,7 @@ search<C>(
4543
4493
  iterationType?): ReturnType<C>[];
4544
4494
  ```
4545
4495
 
4546
- Defined in: [data-structures/binary-tree/bst.ts:969](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L969)
4496
+ Defined in: [data-structures/binary-tree/bst.ts:1008](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1008)
4547
4497
 
4548
4498
  Search nodes by predicate
4549
4499
 
@@ -4617,7 +4567,7 @@ IBinaryTree.search
4617
4567
  set(keyNodeOrEntry, value?): boolean;
4618
4568
  ```
4619
4569
 
4620
- Defined in: [data-structures/binary-tree/bst.ts:1518](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1518)
4570
+ Defined in: [data-structures/binary-tree/bst.ts:1573](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1573)
4621
4571
 
4622
4572
  Adds a new node to the BST based on key comparison.
4623
4573
 
@@ -4683,7 +4633,7 @@ setMany(
4683
4633
  iterationType?): boolean[];
4684
4634
  ```
4685
4635
 
4686
- Defined in: [data-structures/binary-tree/bst.ts:1643](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L1643)
4636
+ Defined in: [data-structures/binary-tree/bst.ts:1706](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L1706)
4687
4637
 
4688
4638
  Adds multiple items to the tree.
4689
4639
 
@@ -4749,7 +4699,7 @@ Space O(N) for sorting and recursion/iteration stack.
4749
4699
  some(predicate, thisArg?): boolean;
4750
4700
  ```
4751
4701
 
4752
- Defined in: [data-structures/base/iterable-entry-base.ts:83](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L83)
4702
+ Defined in: [data-structures/base/iterable-entry-base.ts:83](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-entry-base.ts#L83)
4753
4703
 
4754
4704
  Test whether any entry satisfies the predicate.
4755
4705
 
@@ -4795,7 +4745,7 @@ IBinaryTree.some
4795
4745
  toArray(): [K, V | undefined][];
4796
4746
  ```
4797
4747
 
4798
- Defined in: [data-structures/base/iterable-entry-base.ts:186](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L186)
4748
+ Defined in: [data-structures/base/iterable-entry-base.ts:186](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-entry-base.ts#L186)
4799
4749
 
4800
4750
  Converts data structure to `[key, value]` pairs.
4801
4751
 
@@ -4821,7 +4771,7 @@ Time O(n), Space O(n)
4821
4771
  toVisual(startNode?, options?): string;
4822
4772
  ```
4823
4773
 
4824
- Defined in: [data-structures/binary-tree/binary-tree.ts:2825](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2825)
4774
+ Defined in: [data-structures/binary-tree/binary-tree.ts:2907](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2907)
4825
4775
 
4826
4776
  Generates a string representation of the tree for visualization.
4827
4777
 
@@ -4864,7 +4814,7 @@ Time O(N), visits every node. Space O(N*H) or O(N^2) in the worst case, as the s
4864
4814
  values(): IterableIterator<V | undefined>;
4865
4815
  ```
4866
4816
 
4867
- Defined in: [data-structures/base/iterable-entry-base.ts:53](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-entry-base.ts#L53)
4817
+ Defined in: [data-structures/base/iterable-entry-base.ts:53](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-entry-base.ts#L53)
4868
4818
 
4869
4819
  Iterate over values only.
4870
4820
 
@@ -4899,7 +4849,7 @@ IBinaryTree.values
4899
4849
  protected readonly _comparator: Comparator<K>;
4900
4850
  ```
4901
4851
 
4902
- Defined in: [data-structures/binary-tree/bst.ts:377](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L377)
4852
+ Defined in: [data-structures/binary-tree/bst.ts:376](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L376)
4903
4853
 
4904
4854
  The comparator function used to determine the order of keys in the tree.
4905
4855
 
@@ -4915,7 +4865,7 @@ Time O(1) Space O(1)
4915
4865
  protected readonly _DEFAULT_NODE_CALLBACK: NodeCallback<BinaryTreeNode<K, V> | null | undefined, K | undefined>;
4916
4866
  ```
4917
4867
 
4918
- Defined in: [data-structures/binary-tree/binary-tree.ts:3091](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3091)
4868
+ Defined in: [data-structures/binary-tree/binary-tree.ts:3177](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3177)
4919
4869
 
4920
4870
  (Protected) Default callback function, returns the node's key.
4921
4871
 
@@ -4946,7 +4896,7 @@ protected _bound(
4946
4896
  iterationType): BSTNode<K, V> | undefined;
4947
4897
  ```
4948
4898
 
4949
- Defined in: [data-structures/binary-tree/bst.ts:2899](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2899)
4899
+ Defined in: [data-structures/binary-tree/bst.ts:2993](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2993)
4950
4900
 
4951
4901
  (Protected) Core bound search implementation supporting all parameter types.
4952
4902
  Unified logic for both lowerBound and upperBound.
@@ -4994,7 +4944,7 @@ protected _boundByKey(
4994
4944
  iterationType): BSTNode<K, V> | undefined;
4995
4945
  ```
4996
4946
 
4997
- Defined in: [data-structures/binary-tree/bst.ts:2956](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2956)
4947
+ Defined in: [data-structures/binary-tree/bst.ts:3050](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3050)
4998
4948
 
4999
4949
  (Protected) Binary search for bound by key with pruning optimization.
5000
4950
  Performs standard BST binary search, choosing left or right subtree based on comparator result.
@@ -5035,7 +4985,7 @@ The first node matching the bound condition, or undefined if none exists.
5035
4985
  protected _boundByPredicate(predicate, iterationType): BSTNode<K, V> | undefined;
5036
4986
  ```
5037
4987
 
5038
- Defined in: [data-structures/binary-tree/bst.ts:3011](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3011)
4988
+ Defined in: [data-structures/binary-tree/bst.ts:3105](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3105)
5039
4989
 
5040
4990
  (Protected) In-order traversal search by predicate.
5041
4991
  Falls back to linear in-order traversal when predicate-based search is required.
@@ -5071,7 +5021,7 @@ The first node satisfying predicate, or undefined if none found.
5071
5021
  protected _clearNodes(): void;
5072
5022
  ```
5073
5023
 
5074
- Defined in: [data-structures/binary-tree/binary-tree.ts:3525](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3525)
5024
+ Defined in: [data-structures/binary-tree/binary-tree.ts:3611](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3611)
5075
5025
 
5076
5026
  (Protected) Clears all nodes from the tree.
5077
5027
 
@@ -5095,7 +5045,7 @@ Time O(1)
5095
5045
  protected _clearValues(): void;
5096
5046
  ```
5097
5047
 
5098
- Defined in: [data-structures/binary-tree/binary-tree.ts:3534](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3534)
5048
+ Defined in: [data-structures/binary-tree/binary-tree.ts:3620](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3620)
5099
5049
 
5100
5050
  (Protected) Clears all values from the external store.
5101
5051
 
@@ -5119,7 +5069,7 @@ Time O(N)
5119
5069
  protected _clone(cloned): void;
5120
5070
  ```
5121
5071
 
5122
- Defined in: [data-structures/binary-tree/binary-tree.ts:3184](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3184)
5072
+ Defined in: [data-structures/binary-tree/binary-tree.ts:3270](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3270)
5123
5073
 
5124
5074
  (Protected) Helper for cloning. Performs a BFS and sets all nodes to the new tree.
5125
5075
 
@@ -5151,7 +5101,7 @@ Time O(N * M) (O(N) BFS + O(M) `set` for each node).
5151
5101
  protected _compare(a, b): number;
5152
5102
  ```
5153
5103
 
5154
- Defined in: [data-structures/binary-tree/bst.ts:3275](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3275)
5104
+ Defined in: [data-structures/binary-tree/bst.ts:3369](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3369)
5155
5105
 
5156
5106
  (Protected) Compares two keys using the tree's comparator and reverse setting.
5157
5107
 
@@ -5187,7 +5137,7 @@ Time O(1) Space O(1)
5187
5137
  protected _createDefaultComparator(): Comparator<K>;
5188
5138
  ```
5189
5139
 
5190
- Defined in: [data-structures/binary-tree/bst.ts:2626](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2626)
5140
+ Defined in: [data-structures/binary-tree/bst.ts:2720](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2720)
5191
5141
 
5192
5142
  (Protected) Creates the default comparator function for keys that don't have a custom comparator.
5193
5143
 
@@ -5209,7 +5159,7 @@ Time O(1) Space O(1)
5209
5159
  protected _createInstance<TK, TV, TR>(options?): this;
5210
5160
  ```
5211
5161
 
5212
- Defined in: [data-structures/binary-tree/bst.ts:3073](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3073)
5162
+ Defined in: [data-structures/binary-tree/bst.ts:3167](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3167)
5213
5163
 
5214
5164
  (Protected) Creates a new, empty instance of the same BST constructor.
5215
5165
 
@@ -5257,7 +5207,7 @@ Time O(1)
5257
5207
  protected _createLike<TK, TV, TR>(iter?, options?): BST<TK, TV, TR>;
5258
5208
  ```
5259
5209
 
5260
- Defined in: [data-structures/binary-tree/bst.ts:3090](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3090)
5210
+ Defined in: [data-structures/binary-tree/bst.ts:3184](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3184)
5261
5211
 
5262
5212
  (Protected) Creates a new instance of the same BST constructor, potentially with different generic types.
5263
5213
 
@@ -5317,7 +5267,7 @@ Time O(N log N) or O(N^2) (from constructor) due to processing the iterable.
5317
5267
  protected _deleteByKey(key): boolean;
5318
5268
  ```
5319
5269
 
5320
- Defined in: [data-structures/binary-tree/bst.ts:3286](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3286)
5270
+ Defined in: [data-structures/binary-tree/bst.ts:3380](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3380)
5321
5271
 
5322
5272
  (Private) Deletes a node by its key.
5323
5273
 
@@ -5341,6 +5291,44 @@ Standard BST deletion algorithm. Time O(log N), O(N) worst-case. Space O(1).
5341
5291
 
5342
5292
  ***
5343
5293
 
5294
+ ### \_deleteInternal()
5295
+
5296
+ ```ts
5297
+ protected _deleteInternal(keyNodeEntryRawOrPredicate): BinaryTreeDeleteResult<BinaryTreeNode<K, V>>[];
5298
+ ```
5299
+
5300
+ Defined in: [data-structures/binary-tree/binary-tree.ts:934](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L934)
5301
+
5302
+ **`Internal`**
5303
+
5304
+ Deletes a node from the tree (internal, returns balancing metadata).
5305
+
5306
+ #### Parameters
5307
+
5308
+ ##### keyNodeEntryRawOrPredicate
5309
+
5310
+ \| `NodePredicate`\<[`BinaryTreeNode`](BinaryTreeNode.md)\<`K`, `V`\> \| `null`\>
5311
+ \| `BTNRep`\<`K`, `V`, [`BinaryTreeNode`](BinaryTreeNode.md)\<`K`, `V`\>\>
5312
+
5313
+ The node to delete.
5314
+
5315
+ #### Returns
5316
+
5317
+ `BinaryTreeDeleteResult`\<[`BinaryTreeNode`](BinaryTreeNode.md)\<`K`, `V`\>\>[]
5318
+
5319
+ An array containing deletion results with balancing metadata.
5320
+
5321
+ #### Remarks
5322
+
5323
+ Time O(N) — O(N) to find the node + O(H) for predecessor swap. Space O(1). BST/Red-Black Tree/AVL Tree subclasses override to O(log N).
5324
+ Used by AVL/BST subclasses that need balancing metadata after deletion.
5325
+
5326
+ #### Inherited from
5327
+
5328
+ [`BinaryTree`](BinaryTree.md).[`_deleteInternal`](BinaryTree.md#_deleteinternal)
5329
+
5330
+ ***
5331
+
5344
5332
  ### \_dfs()
5345
5333
 
5346
5334
  ```ts
@@ -5357,7 +5345,7 @@ protected _dfs<C>(
5357
5345
  shouldProcessRoot?): ReturnType<C>[];
5358
5346
  ```
5359
5347
 
5360
- Defined in: [data-structures/binary-tree/binary-tree.ts:2902](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L2902)
5348
+ Defined in: [data-structures/binary-tree/binary-tree.ts:2988](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L2988)
5361
5349
 
5362
5350
  #### Type Parameters
5363
5351
 
@@ -5450,7 +5438,7 @@ Array of callback results.
5450
5438
  protected _displayAux(node, options): NodeDisplayLayout;
5451
5439
  ```
5452
5440
 
5453
- Defined in: [data-structures/binary-tree/binary-tree.ts:3208](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3208)
5441
+ Defined in: [data-structures/binary-tree/binary-tree.ts:3294](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3294)
5454
5442
 
5455
5443
  (Protected) Recursive helper for `toVisual`.
5456
5444
 
@@ -5490,7 +5478,7 @@ Time O(N), Space O(N*H) or O(N^2)
5490
5478
  protected _ensurePredicate(keyNodeEntryOrPredicate): NodePredicate<BinaryTreeNode<K, V>>;
5491
5479
  ```
5492
5480
 
5493
- Defined in: [data-structures/binary-tree/binary-tree.ts:3431](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3431)
5481
+ Defined in: [data-structures/binary-tree/binary-tree.ts:3517](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3517)
5494
5482
 
5495
5483
  (Protected) Converts a key, node, entry, or predicate into a standardized predicate function.
5496
5484
 
@@ -5529,7 +5517,7 @@ Time O(1)
5529
5517
  protected _extractKey(keyNodeOrEntry): K | null | undefined;
5530
5518
  ```
5531
5519
 
5532
- Defined in: [data-structures/binary-tree/binary-tree.ts:3491](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3491)
5520
+ Defined in: [data-structures/binary-tree/binary-tree.ts:3577](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3577)
5533
5521
 
5534
5522
  (Protected) Extracts the key from a key, node, or entry.
5535
5523
 
@@ -5567,7 +5555,7 @@ Time O(1)
5567
5555
  protected _floorByKey(key, iterationType): BSTNode<K, V> | undefined;
5568
5556
  ```
5569
5557
 
5570
- Defined in: [data-structures/binary-tree/bst.ts:2664](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2664)
5558
+ Defined in: [data-structures/binary-tree/bst.ts:2758](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2758)
5571
5559
 
5572
5560
  (Protected) Binary search for floor by key with pruning optimization.
5573
5561
  Performs standard BST binary search, choosing left or right subtree based on comparator result.
@@ -5605,7 +5593,7 @@ Time O(h) where h is tree height.
5605
5593
  protected _floorByPredicate(predicate, iterationType): BSTNode<K, V> | undefined;
5606
5594
  ```
5607
5595
 
5608
- Defined in: [data-structures/binary-tree/bst.ts:2717](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2717)
5596
+ Defined in: [data-structures/binary-tree/bst.ts:2811](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2811)
5609
5597
 
5610
5598
  (Protected) In-order traversal search for floor by predicate.
5611
5599
  Falls back to linear in-order traversal when predicate-based search is required.
@@ -5644,7 +5632,7 @@ Space Complexity: O(h) for recursion, O(h) for iterative stack.
5644
5632
  protected _getByRankIterative(node, k): BSTNode<K, V> | undefined;
5645
5633
  ```
5646
5634
 
5647
- Defined in: [data-structures/binary-tree/bst.ts:3167](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3167)
5635
+ Defined in: [data-structures/binary-tree/bst.ts:3261](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3261)
5648
5636
 
5649
5637
  (Protected) Finds the node at position k in tree order (iterative).
5650
5638
 
@@ -5674,7 +5662,7 @@ Time O(log n), Space O(1)
5674
5662
  protected _getByRankRecursive(node, k): BSTNode<K, V> | undefined;
5675
5663
  ```
5676
5664
 
5677
- Defined in: [data-structures/binary-tree/bst.ts:3188](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3188)
5665
+ Defined in: [data-structures/binary-tree/bst.ts:3282](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3282)
5678
5666
 
5679
5667
  (Protected) Finds the node at position k in tree order (recursive).
5680
5668
 
@@ -5704,7 +5692,7 @@ Time O(log n), Space O(log n) call stack
5704
5692
  protected _getIterator(node?): IterableIterator<[K, V | undefined]>;
5705
5693
  ```
5706
5694
 
5707
- Defined in: [data-structures/binary-tree/binary-tree.ts:3047](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3047)
5695
+ Defined in: [data-structures/binary-tree/binary-tree.ts:3133](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3133)
5708
5696
 
5709
5697
  (Protected) Gets the iterator for the tree (default in-order).
5710
5698
 
@@ -5738,7 +5726,7 @@ Time O(N) for full iteration. O(H) to get the first element. Space O(H) for the
5738
5726
  protected _getRankIterative(node, key): number;
5739
5727
  ```
5740
5728
 
5741
- Defined in: [data-structures/binary-tree/bst.ts:3200](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3200)
5729
+ Defined in: [data-structures/binary-tree/bst.ts:3294](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3294)
5742
5730
 
5743
5731
  (Protected) Computes the rank of a key iteratively.
5744
5732
 
@@ -5768,7 +5756,7 @@ Time O(log n), Space O(1)
5768
5756
  protected _getRankRecursive(node, key): number;
5769
5757
  ```
5770
5758
 
5771
- Defined in: [data-structures/binary-tree/bst.ts:3226](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3226)
5759
+ Defined in: [data-structures/binary-tree/bst.ts:3320](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3320)
5772
5760
 
5773
5761
  (Protected) Computes the rank of a key recursively.
5774
5762
 
@@ -5798,7 +5786,7 @@ Time O(log n), Space O(log n) call stack
5798
5786
  protected _isDisplayLeaf(node, options): boolean;
5799
5787
  ```
5800
5788
 
5801
- Defined in: [data-structures/binary-tree/binary-tree.ts:3303](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3303)
5789
+ Defined in: [data-structures/binary-tree/binary-tree.ts:3389](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3389)
5802
5790
 
5803
5791
  Check if a node is a display leaf (empty, null, undefined, NIL, or real leaf).
5804
5792
 
@@ -5828,7 +5816,7 @@ Check if a node is a display leaf (empty, null, undefined, NIL, or real leaf).
5828
5816
  protected _isPredicate(p): p is NodePredicate<BinaryTreeNode<K, V>>;
5829
5817
  ```
5830
5818
 
5831
- Defined in: [data-structures/binary-tree/binary-tree.ts:3480](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3480)
5819
+ Defined in: [data-structures/binary-tree/binary-tree.ts:3566](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3566)
5832
5820
 
5833
5821
  (Protected) Checks if an item is a predicate function.
5834
5822
 
@@ -5862,7 +5850,7 @@ Time O(1)
5862
5850
  protected _keyValueNodeOrEntryToNodeAndValue(keyNodeOrEntry, value?): [OptNode<BSTNode<K, V>>, V | undefined];
5863
5851
  ```
5864
5852
 
5865
- Defined in: [data-structures/binary-tree/bst.ts:3124](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3124)
5853
+ Defined in: [data-structures/binary-tree/bst.ts:3218](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3218)
5866
5854
 
5867
5855
  (Protected) Converts a key, node, or entry into a standardized [node, value] tuple.
5868
5856
 
@@ -5906,7 +5894,7 @@ Time O(1)
5906
5894
  protected _lowerByKey(key, iterationType): BSTNode<K, V> | undefined;
5907
5895
  ```
5908
5896
 
5909
- Defined in: [data-structures/binary-tree/bst.ts:2782](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2782)
5897
+ Defined in: [data-structures/binary-tree/bst.ts:2876](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2876)
5910
5898
 
5911
5899
  (Protected) Binary search for lower by key with pruning optimization.
5912
5900
  Performs standard BST binary search, choosing left or right subtree based on comparator result.
@@ -5944,7 +5932,7 @@ Time O(h) where h is tree height.
5944
5932
  protected _lowerByPredicate(predicate, iterationType): BSTNode<K, V> | undefined;
5945
5933
  ```
5946
5934
 
5947
- Defined in: [data-structures/binary-tree/bst.ts:2835](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L2835)
5935
+ Defined in: [data-structures/binary-tree/bst.ts:2929](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L2929)
5948
5936
 
5949
5937
  (Protected) In-order traversal search for lower by predicate.
5950
5938
  Falls back to linear in-order traversal when predicate-based search is required.
@@ -5983,7 +5971,7 @@ Space Complexity: O(h) for recursion, O(h) for iterative stack.
5983
5971
  protected _next(node): BSTNode<K, V> | undefined;
5984
5972
  ```
5985
5973
 
5986
- Defined in: [data-structures/binary-tree/bst.ts:3243](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3243)
5974
+ Defined in: [data-structures/binary-tree/bst.ts:3337](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3337)
5987
5975
 
5988
5976
  (Protected) Finds the in-order successor of a node.
5989
5977
 
@@ -6009,7 +5997,7 @@ Time O(log n), Space O(1)
6009
5997
  protected _replaceNode(oldNode, newNode): BinaryTreeNode<K, V>;
6010
5998
  ```
6011
5999
 
6012
- Defined in: [data-structures/binary-tree/binary-tree.ts:3393](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3393)
6000
+ Defined in: [data-structures/binary-tree/binary-tree.ts:3479](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3479)
6013
6001
 
6014
6002
  (Protected) Replaces a node in the tree with a new node, maintaining children and parent links.
6015
6003
 
@@ -6052,7 +6040,7 @@ protected _resolveDisplayLeaf(
6052
6040
  emptyDisplayLayout): NodeDisplayLayout;
6053
6041
  ```
6054
6042
 
6055
- Defined in: [data-structures/binary-tree/binary-tree.ts:3333](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3333)
6043
+ Defined in: [data-structures/binary-tree/binary-tree.ts:3419](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3419)
6056
6044
 
6057
6045
  Resolve a display leaf node to its layout.
6058
6046
 
@@ -6086,7 +6074,7 @@ Resolve a display leaf node to its layout.
6086
6074
  protected _setRoot(v): void;
6087
6075
  ```
6088
6076
 
6089
- Defined in: [data-structures/binary-tree/bst.ts:3262](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3262)
6077
+ Defined in: [data-structures/binary-tree/bst.ts:3356](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3356)
6090
6078
 
6091
6079
  (Protected) Sets the root node and clears its parent reference.
6092
6080
 
@@ -6118,7 +6106,7 @@ Time O(1)
6118
6106
  protected _setValue(key, value): boolean;
6119
6107
  ```
6120
6108
 
6121
- Defined in: [data-structures/binary-tree/binary-tree.ts:3512](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3512)
6109
+ Defined in: [data-structures/binary-tree/binary-tree.ts:3598](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3598)
6122
6110
 
6123
6111
  (Protected) Sets a value in the external store (Map mode).
6124
6112
 
@@ -6158,7 +6146,7 @@ Time O(1) (average for Map.set).
6158
6146
  protected _snapshotOptions<TK, TV, TR>(): BSTOptions<TK, TV, TR>;
6159
6147
  ```
6160
6148
 
6161
- Defined in: [data-structures/binary-tree/bst.ts:3108](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3108)
6149
+ Defined in: [data-structures/binary-tree/bst.ts:3202](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3202)
6162
6150
 
6163
6151
  (Protected) Snapshots the current BST's configuration options.
6164
6152
 
@@ -6198,7 +6186,7 @@ Time O(1)
6198
6186
  protected _swapProperties(srcNode, destNode): BinaryTreeNode<K, V> | undefined;
6199
6187
  ```
6200
6188
 
6201
- Defined in: [data-structures/binary-tree/binary-tree.ts:3359](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/binary-tree.ts#L3359)
6189
+ Defined in: [data-structures/binary-tree/binary-tree.ts:3445](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/binary-tree.ts#L3445)
6202
6190
 
6203
6191
  (Protected) Swaps the key/value properties of two nodes.
6204
6192
 
@@ -6246,7 +6234,7 @@ Time O(1)
6246
6234
  protected _updateCount(node): void;
6247
6235
  ```
6248
6236
 
6249
- Defined in: [data-structures/binary-tree/bst.ts:3143](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3143)
6237
+ Defined in: [data-structures/binary-tree/bst.ts:3237](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3237)
6250
6238
 
6251
6239
  (Protected) Recalculates the subtree count for a single node.
6252
6240
 
@@ -6272,7 +6260,7 @@ Time O(1). Only active when enableOrderStatistic is true.
6272
6260
  protected _updateCountAlongPath(node): void;
6273
6261
  ```
6274
6262
 
6275
- Defined in: [data-structures/binary-tree/bst.ts:3154](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/binary-tree/bst.ts#L3154)
6263
+ Defined in: [data-structures/binary-tree/bst.ts:3248](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/bst.ts#L3248)
6276
6264
 
6277
6265
  (Protected) Updates subtree counts from a node up to the root.
6278
6266