data-structure-typed 2.5.1 → 2.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/CHANGELOG.md +3 -1
  2. package/README.md +75 -17
  3. package/dist/cjs/binary-tree.cjs +2723 -139
  4. package/dist/cjs/graph.cjs +192 -6
  5. package/dist/cjs/hash.cjs +63 -15
  6. package/dist/cjs/heap.cjs +93 -31
  7. package/dist/cjs/index.cjs +3514 -379
  8. package/dist/cjs/linked-list.cjs +237 -31
  9. package/dist/cjs/matrix.cjs +47 -9
  10. package/dist/cjs/priority-queue.cjs +92 -30
  11. package/dist/cjs/queue.cjs +176 -2
  12. package/dist/cjs/stack.cjs +48 -2
  13. package/dist/cjs/trie.cjs +78 -28
  14. package/dist/cjs-legacy/binary-tree.cjs +2725 -136
  15. package/dist/cjs-legacy/graph.cjs +192 -6
  16. package/dist/cjs-legacy/hash.cjs +63 -15
  17. package/dist/cjs-legacy/heap.cjs +93 -31
  18. package/dist/cjs-legacy/index.cjs +3389 -249
  19. package/dist/cjs-legacy/linked-list.cjs +237 -31
  20. package/dist/cjs-legacy/matrix.cjs +47 -9
  21. package/dist/cjs-legacy/priority-queue.cjs +92 -30
  22. package/dist/cjs-legacy/queue.cjs +176 -2
  23. package/dist/cjs-legacy/stack.cjs +48 -2
  24. package/dist/cjs-legacy/trie.cjs +78 -28
  25. package/dist/esm/binary-tree.mjs +2723 -139
  26. package/dist/esm/graph.mjs +192 -6
  27. package/dist/esm/hash.mjs +63 -15
  28. package/dist/esm/heap.mjs +93 -31
  29. package/dist/esm/index.mjs +3514 -380
  30. package/dist/esm/linked-list.mjs +237 -31
  31. package/dist/esm/matrix.mjs +47 -9
  32. package/dist/esm/priority-queue.mjs +92 -30
  33. package/dist/esm/queue.mjs +176 -2
  34. package/dist/esm/stack.mjs +48 -2
  35. package/dist/esm/trie.mjs +78 -28
  36. package/dist/esm-legacy/binary-tree.mjs +2725 -136
  37. package/dist/esm-legacy/graph.mjs +192 -6
  38. package/dist/esm-legacy/hash.mjs +63 -15
  39. package/dist/esm-legacy/heap.mjs +93 -31
  40. package/dist/esm-legacy/index.mjs +3389 -250
  41. package/dist/esm-legacy/linked-list.mjs +237 -31
  42. package/dist/esm-legacy/matrix.mjs +47 -9
  43. package/dist/esm-legacy/priority-queue.mjs +92 -30
  44. package/dist/esm-legacy/queue.mjs +176 -2
  45. package/dist/esm-legacy/stack.mjs +48 -2
  46. package/dist/esm-legacy/trie.mjs +78 -28
  47. package/dist/types/common/error.d.ts +9 -0
  48. package/dist/types/common/index.d.ts +1 -1
  49. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +48 -0
  50. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +56 -0
  51. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +102 -2
  52. package/dist/types/data-structures/binary-tree/bst.d.ts +195 -0
  53. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +76 -0
  54. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +24 -0
  55. package/dist/types/data-structures/binary-tree/tree-map.d.ts +528 -0
  56. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +531 -6
  57. package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +435 -6
  58. package/dist/types/data-structures/binary-tree/tree-set.d.ts +505 -0
  59. package/dist/types/data-structures/graph/directed-graph.d.ts +40 -0
  60. package/dist/types/data-structures/graph/undirected-graph.d.ts +36 -0
  61. package/dist/types/data-structures/hash/hash-map.d.ts +44 -0
  62. package/dist/types/data-structures/heap/heap.d.ts +56 -0
  63. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +68 -0
  64. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +60 -0
  65. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +72 -0
  66. package/dist/types/data-structures/matrix/matrix.d.ts +32 -0
  67. package/dist/types/data-structures/queue/deque.d.ts +60 -0
  68. package/dist/types/data-structures/queue/queue.d.ts +48 -0
  69. package/dist/types/data-structures/stack/stack.d.ts +40 -0
  70. package/dist/types/data-structures/trie/trie.d.ts +48 -0
  71. package/dist/types/types/data-structures/binary-tree/bst.d.ts +1 -0
  72. package/dist/types/types/data-structures/binary-tree/tree-map.d.ts +5 -0
  73. package/dist/types/types/data-structures/binary-tree/tree-multi-set.d.ts +4 -0
  74. package/dist/types/types/data-structures/binary-tree/tree-set.d.ts +4 -0
  75. package/dist/umd/data-structure-typed.js +3404 -265
  76. package/dist/umd/data-structure-typed.min.js +5 -5
  77. package/docs-site-docusaurus/docs/api/classes/AVLTree.md +650 -136
  78. package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +11 -11
  79. package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +71 -71
  80. package/docs-site-docusaurus/docs/api/classes/BST.md +591 -129
  81. package/docs-site-docusaurus/docs/api/classes/BSTNode.md +13 -13
  82. package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +15 -15
  83. package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +107 -107
  84. package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +13 -13
  85. package/docs-site-docusaurus/docs/api/classes/Deque.md +82 -82
  86. package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +82 -82
  87. package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +74 -74
  88. package/docs-site-docusaurus/docs/api/classes/DoublyLinkedListNode.md +8 -8
  89. package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +9 -9
  90. package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +1 -1
  91. package/docs-site-docusaurus/docs/api/classes/HashMap.md +47 -47
  92. package/docs-site-docusaurus/docs/api/classes/Heap.md +45 -45
  93. package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +25 -25
  94. package/docs-site-docusaurus/docs/api/classes/IterableEntryBase.md +33 -33
  95. package/docs-site-docusaurus/docs/api/classes/LinearBase.md +50 -50
  96. package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +55 -55
  97. package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +49 -49
  98. package/docs-site-docusaurus/docs/api/classes/LinkedListNode.md +6 -6
  99. package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +78 -78
  100. package/docs-site-docusaurus/docs/api/classes/MapGraph.md +82 -82
  101. package/docs-site-docusaurus/docs/api/classes/Matrix.md +31 -31
  102. package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +45 -45
  103. package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +45 -45
  104. package/docs-site-docusaurus/docs/api/classes/MinHeap.md +45 -45
  105. package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +45 -45
  106. package/docs-site-docusaurus/docs/api/classes/Navigator.md +5 -5
  107. package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +44 -44
  108. package/docs-site-docusaurus/docs/api/classes/Queue.md +60 -60
  109. package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +660 -146
  110. package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +10 -10
  111. package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +78 -78
  112. package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +6 -6
  113. package/docs-site-docusaurus/docs/api/classes/SkipList.md +44 -44
  114. package/docs-site-docusaurus/docs/api/classes/Stack.md +39 -39
  115. package/docs-site-docusaurus/docs/api/classes/TreeMap.md +165 -33
  116. package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +162 -46
  117. package/docs-site-docusaurus/docs/api/classes/TreeSet.md +161 -32
  118. package/docs-site-docusaurus/docs/api/classes/Trie.md +47 -47
  119. package/docs-site-docusaurus/docs/api/classes/TrieNode.md +8 -8
  120. package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +81 -81
  121. package/docs-site-docusaurus/docs/guide/architecture.md +2 -0
  122. package/docs-site-docusaurus/docs/guide/concepts.md +32 -1
  123. package/docs-site-docusaurus/docs/guide/faq.md +180 -0
  124. package/docs-site-docusaurus/docs/guide/guides.md +40 -54
  125. package/docs-site-docusaurus/docs/guide/installation.md +2 -0
  126. package/docs-site-docusaurus/docs/guide/integrations.md +2 -0
  127. package/docs-site-docusaurus/docs/guide/overview.md +7 -0
  128. package/docs-site-docusaurus/docs/guide/performance.md +2 -0
  129. package/docs-site-docusaurus/docs/guide/quick-start.md +31 -0
  130. package/docs-site-docusaurus/docs/guide/use-cases/_category_.json +6 -0
  131. package/docs-site-docusaurus/docs/guide/use-cases/array-sort-alternative.md +158 -0
  132. package/docs-site-docusaurus/docs/guide/use-cases/heap-vs-sorting.md +92 -0
  133. package/docs-site-docusaurus/docs/guide/use-cases/map-vs-treemap.md +151 -0
  134. package/docs-site-docusaurus/docs/guide/use-cases/priority-queue-typescript.md +113 -0
  135. package/docs-site-docusaurus/docs/guide/use-cases/treemap-javascript.md +151 -0
  136. package/docs-site-docusaurus/docusaurus.config.ts +1 -1
  137. package/docs-site-docusaurus/src/pages/index.tsx +51 -2
  138. package/docs-site-docusaurus/static/llms.txt +37 -0
  139. package/llms.txt +37 -0
  140. package/package.json +64 -56
  141. package/src/common/error.ts +19 -1
  142. package/src/common/index.ts +1 -1
  143. package/src/data-structures/base/iterable-element-base.ts +3 -2
  144. package/src/data-structures/binary-tree/avl-tree.ts +47 -0
  145. package/src/data-structures/binary-tree/binary-indexed-tree.ts +46 -4
  146. package/src/data-structures/binary-tree/binary-tree.ts +79 -4
  147. package/src/data-structures/binary-tree/bst.ts +441 -6
  148. package/src/data-structures/binary-tree/red-black-tree.ts +73 -0
  149. package/src/data-structures/binary-tree/segment-tree.ts +18 -0
  150. package/src/data-structures/binary-tree/tree-map.ts +434 -9
  151. package/src/data-structures/binary-tree/tree-multi-map.ts +426 -5
  152. package/src/data-structures/binary-tree/tree-multi-set.ts +350 -6
  153. package/src/data-structures/binary-tree/tree-set.ts +410 -8
  154. package/src/data-structures/graph/abstract-graph.ts +2 -2
  155. package/src/data-structures/graph/directed-graph.ts +30 -0
  156. package/src/data-structures/graph/undirected-graph.ts +27 -0
  157. package/src/data-structures/hash/hash-map.ts +35 -4
  158. package/src/data-structures/heap/heap.ts +46 -4
  159. package/src/data-structures/heap/max-heap.ts +2 -2
  160. package/src/data-structures/linked-list/doubly-linked-list.ts +51 -0
  161. package/src/data-structures/linked-list/singly-linked-list.ts +45 -0
  162. package/src/data-structures/linked-list/skip-linked-list.ts +59 -5
  163. package/src/data-structures/matrix/matrix.ts +33 -9
  164. package/src/data-structures/priority-queue/max-priority-queue.ts +2 -2
  165. package/src/data-structures/queue/deque.ts +45 -0
  166. package/src/data-structures/queue/queue.ts +36 -0
  167. package/src/data-structures/stack/stack.ts +30 -0
  168. package/src/data-structures/trie/trie.ts +38 -2
  169. package/src/types/data-structures/binary-tree/bst.ts +1 -0
  170. package/src/types/data-structures/binary-tree/tree-map.ts +6 -0
  171. package/src/types/data-structures/binary-tree/tree-multi-set.ts +5 -0
  172. package/src/types/data-structures/binary-tree/tree-set.ts +5 -0
@@ -254,6 +254,7 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
254
254
  */
255
255
  constructor(keysNodesEntriesOrRaws?: Iterable<K | BSTNode | [K | null | undefined, V | undefined] | null | undefined | R>, options?: BSTOptions<K, V, R>);
256
256
  protected _root?: BSTNode<K, V>;
257
+ protected _enableOrderStatistic: boolean;
257
258
  /**
258
259
  * Gets the root node of the tree.
259
260
  * @remarks Time O(1)
@@ -363,6 +364,14 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
363
364
 
364
365
 
365
366
 
367
+
368
+
369
+
370
+
371
+
372
+
373
+
374
+
366
375
 
367
376
 
368
377
 
@@ -427,6 +436,14 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
427
436
 
428
437
 
429
438
 
439
+
440
+
441
+
442
+
443
+
444
+
445
+
446
+
430
447
 
431
448
 
432
449
 
@@ -494,6 +511,14 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
494
511
 
495
512
 
496
513
 
514
+
515
+
516
+
517
+
518
+
519
+
520
+
521
+
497
522
 
498
523
 
499
524
 
@@ -572,6 +597,14 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
572
597
 
573
598
 
574
599
 
600
+
601
+
602
+
603
+
604
+
605
+
606
+
607
+
575
608
 
576
609
 
577
610
 
@@ -634,6 +667,14 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
634
667
 
635
668
 
636
669
 
670
+
671
+
672
+
673
+
674
+
675
+
676
+
677
+
637
678
 
638
679
 
639
680
 
@@ -679,6 +720,10 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
679
720
 
680
721
 
681
722
 
723
+
724
+
725
+
726
+
682
727
 
683
728
 
684
729
 
@@ -691,6 +736,69 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
691
736
  */
692
737
  rangeSearch(range: Range<K> | [K, K]): (K | undefined)[];
693
738
  rangeSearch<C extends NodeCallback<BSTNode<K, V>>>(range: Range<K> | [K, K], callback: C, startNode?: K | BSTNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, iterationType?: IterationType): ReturnType<C>[];
739
+ /**
740
+ * Returns the element at the k-th position in tree order (0-indexed).
741
+ * @remarks Time O(log n), Space O(1) iterative / O(log n) recursive. Requires `enableOrderStatistic: true`.
742
+ * Tree order is defined by the comparator — ascending by default, but respects custom comparators (e.g. descending).
743
+ *
744
+ * @param k - The 0-based position in tree order (0 = first element).
745
+ * @returns The key at position k, or `undefined` if out of bounds.
746
+ * @example
747
+ * // Order-statistic on BST
748
+ * const tree = new BST<number>([30, 10, 50, 20, 40], { enableOrderStatistic: true });
749
+ * console.log(tree.getByRank(0)); // 10;
750
+ * console.log(tree.getByRank(4)); // 50;
751
+ * console.log(tree.getRank(30)); // 2;
752
+ */
753
+ getByRank(k: number): K | undefined;
754
+ /**
755
+ * Returns the element at the k-th position in tree order and applies a callback.
756
+ * @remarks Time O(log n), Space O(1) iterative / O(log n) recursive. Requires `enableOrderStatistic: true`.
757
+ *
758
+ * @param k - The 0-based position in tree order (0 = first element).
759
+ * @param callback - Callback to apply to the found node.
760
+ * @param iterationType - Iteration strategy ('ITERATIVE' or 'RECURSIVE').
761
+ * @returns The callback result, or `undefined` if out of bounds.
762
+ */
763
+ getByRank<C extends NodeCallback<BSTNode<K, V>>>(k: number, callback: C, iterationType?: IterationType): ReturnType<C> | undefined;
764
+ /**
765
+ * Returns the 0-based rank of a key (number of elements that precede it in tree order).
766
+ * @remarks Time O(log n), Space O(1) iterative / O(log n) recursive. Requires `enableOrderStatistic: true`.
767
+ * Tree order is defined by the comparator. When the key is not found, returns the insertion position.
768
+ *
769
+ * @param keyNodeEntryOrPredicate - The key, node, entry `[K, V]`, or predicate to find.
770
+ * @returns The rank (0-indexed), or -1 if the tree is empty or input is invalid.
771
+ */
772
+ getRank(keyNodeEntryOrPredicate: K | BSTNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | NodePredicate<BSTNode<K, V>>): number;
773
+ /**
774
+ * Returns the 0-based rank (number of preceding elements in tree order) with explicit iteration type.
775
+ * @remarks Time O(log n), Space O(1) iterative / O(log n) recursive. Requires `enableOrderStatistic: true`.
776
+ *
777
+ * @param keyNodeEntryOrPredicate - The key, node, entry, or predicate to find.
778
+ * @param iterationType - Iteration strategy ('ITERATIVE' or 'RECURSIVE').
779
+ * @returns The rank (0-indexed), or -1 if the tree is empty or input is invalid.
780
+ */
781
+ getRank(keyNodeEntryOrPredicate: K | BSTNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | NodePredicate<BSTNode<K, V>>, iterationType: IterationType): number;
782
+ /**
783
+ * Returns elements by position range in tree order (0-indexed, inclusive on both ends).
784
+ * @remarks Time O(log n + k), Space O(k), where k = end - start + 1. Requires `enableOrderStatistic: true`.
785
+ *
786
+ * @param start - Start position (inclusive, 0-indexed). Clamped to 0 if negative.
787
+ * @param end - End position (inclusive, 0-indexed). Clamped to size-1 if too large.
788
+ * @returns Array of keys in tree order within the specified range.
789
+ */
790
+ rangeByRank(start: number, end: number): (K | undefined)[];
791
+ /**
792
+ * Returns elements by position range in tree order with callback and optional iteration type.
793
+ * @remarks Time O(log n + k), Space O(k), where k = end - start + 1. Requires `enableOrderStatistic: true`.
794
+ *
795
+ * @param start - Start rank (inclusive, 0-indexed).
796
+ * @param end - End rank (inclusive, 0-indexed).
797
+ * @param callback - Callback to apply to each node in the range.
798
+ * @param iterationType - Iteration strategy ('ITERATIVE' or 'RECURSIVE').
799
+ * @returns Array of callback results for nodes in the rank range.
800
+ */
801
+ rangeByRank<C extends NodeCallback<BSTNode<K, V>>>(start: number, end: number, callback: C, iterationType?: IterationType): ReturnType<C>[];
694
802
  /**
695
803
  * Adds a new node to the BST based on key comparison.
696
804
  * @remarks Time O(log N), where H is tree height. O(N) worst-case (unbalanced tree), O(log N) average. Space O(1).
@@ -770,6 +878,18 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
770
878
 
771
879
 
772
880
 
881
+
882
+
883
+
884
+
885
+
886
+
887
+
888
+
889
+
890
+
891
+
892
+
773
893
 
774
894
 
775
895
 
@@ -844,6 +964,14 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
844
964
 
845
965
 
846
966
 
967
+
968
+
969
+
970
+
971
+
972
+
973
+
974
+
847
975
 
848
976
 
849
977
 
@@ -892,6 +1020,10 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
892
1020
 
893
1021
 
894
1022
 
1023
+
1024
+
1025
+
1026
+
895
1027
 
896
1028
 
897
1029
 
@@ -942,6 +1074,10 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
942
1074
 
943
1075
 
944
1076
 
1077
+
1078
+
1079
+
1080
+
945
1081
 
946
1082
 
947
1083
 
@@ -991,6 +1127,10 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
991
1127
 
992
1128
 
993
1129
 
1130
+
1131
+
1132
+
1133
+
994
1134
 
995
1135
 
996
1136
 
@@ -1041,6 +1181,10 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
1041
1181
 
1042
1182
 
1043
1183
 
1184
+
1185
+
1186
+
1187
+
1044
1188
 
1045
1189
 
1046
1190
 
@@ -1091,6 +1235,10 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
1091
1235
 
1092
1236
 
1093
1237
 
1238
+
1239
+
1240
+
1241
+
1094
1242
 
1095
1243
 
1096
1244
 
@@ -1136,6 +1284,10 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
1136
1284
 
1137
1285
 
1138
1286
 
1287
+
1288
+
1289
+
1290
+
1139
1291
 
1140
1292
 
1141
1293
 
@@ -1209,6 +1361,14 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
1209
1361
 
1210
1362
 
1211
1363
 
1364
+
1365
+
1366
+
1367
+
1368
+
1369
+
1370
+
1371
+
1212
1372
 
1213
1373
 
1214
1374
 
@@ -1388,6 +1548,41 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
1388
1548
  *
1389
1549
  * @param v - The node to set as root.
1390
1550
  */
1551
+ /**
1552
+ * (Protected) Recalculates the subtree count for a single node.
1553
+ * @remarks Time O(1). Only active when enableOrderStatistic is true.
1554
+ */
1555
+ protected _updateCount(node: BSTNode<K, V>): void;
1556
+ /**
1557
+ * (Protected) Updates subtree counts from a node up to the root.
1558
+ * @remarks Time O(log n). Only active when enableOrderStatistic is true.
1559
+ */
1560
+ protected _updateCountAlongPath(node: OptNode<BSTNode<K, V>>): void;
1561
+ /**
1562
+ * (Protected) Finds the node at position k in tree order (iterative).
1563
+ * @remarks Time O(log n), Space O(1)
1564
+ */
1565
+ protected _getByRankIterative(node: OptNode<BSTNode<K, V>>, k: number): BSTNode<K, V> | undefined;
1566
+ /**
1567
+ * (Protected) Finds the node at position k in tree order (recursive).
1568
+ * @remarks Time O(log n), Space O(log n) call stack
1569
+ */
1570
+ protected _getByRankRecursive(node: OptNode<BSTNode<K, V>>, k: number): BSTNode<K, V> | undefined;
1571
+ /**
1572
+ * (Protected) Computes the rank of a key iteratively.
1573
+ * @remarks Time O(log n), Space O(1)
1574
+ */
1575
+ protected _getRankIterative(node: OptNode<BSTNode<K, V>>, key: K): number;
1576
+ /**
1577
+ * (Protected) Computes the rank of a key recursively.
1578
+ * @remarks Time O(log n), Space O(log n) call stack
1579
+ */
1580
+ protected _getRankRecursive(node: OptNode<BSTNode<K, V>>, key: K): number;
1581
+ /**
1582
+ * (Protected) Finds the in-order successor of a node.
1583
+ * @remarks Time O(log n), Space O(1)
1584
+ */
1585
+ protected _next(node: BSTNode<K, V>): BSTNode<K, V> | undefined;
1391
1586
  protected _setRoot(v: OptNode<BSTNode<K, V>>): void;
1392
1587
  /**
1393
1588
  * (Protected) Compares two keys using the tree's comparator and reverse setting.
@@ -322,6 +322,22 @@ export declare class RedBlackTree<K = any, V = any, R = any> extends BST<K, V, R
322
322
 
323
323
 
324
324
 
325
+
326
+
327
+
328
+
329
+
330
+
331
+
332
+
333
+
334
+
335
+
336
+
337
+
338
+
339
+
340
+
325
341
 
326
342
 
327
343
 
@@ -544,6 +560,22 @@ export declare class RedBlackTree<K = any, V = any, R = any> extends BST<K, V, R
544
560
 
545
561
 
546
562
 
563
+
564
+
565
+
566
+
567
+
568
+
569
+
570
+
571
+
572
+
573
+
574
+
575
+
576
+
577
+
578
+
547
579
 
548
580
 
549
581
 
@@ -686,6 +718,22 @@ export declare class RedBlackTree<K = any, V = any, R = any> extends BST<K, V, R
686
718
 
687
719
 
688
720
 
721
+
722
+
723
+
724
+
725
+
726
+
727
+
728
+
729
+
730
+
731
+
732
+
733
+
734
+
735
+
736
+
689
737
 
690
738
 
691
739
 
@@ -798,6 +846,18 @@ export declare class RedBlackTree<K = any, V = any, R = any> extends BST<K, V, R
798
846
 
799
847
 
800
848
 
849
+
850
+
851
+
852
+
853
+
854
+
855
+
856
+
857
+
858
+
859
+
860
+
801
861
 
802
862
 
803
863
 
@@ -918,6 +978,22 @@ export declare class RedBlackTree<K = any, V = any, R = any> extends BST<K, V, R
918
978
 
919
979
 
920
980
 
981
+
982
+
983
+
984
+
985
+
986
+
987
+
988
+
989
+
990
+
991
+
992
+
993
+
994
+
995
+
996
+
921
997
 
922
998
 
923
999
 
@@ -71,6 +71,10 @@ export declare class SegmentTree<E = number> implements Iterable<E> {
71
71
 
72
72
 
73
73
 
74
+
75
+
76
+
77
+
74
78
 
75
79
 
76
80
 
@@ -128,6 +132,10 @@ export declare class SegmentTree<E = number> implements Iterable<E> {
128
132
 
129
133
 
130
134
 
135
+
136
+
137
+
138
+
131
139
 
132
140
 
133
141
 
@@ -181,6 +189,10 @@ export declare class SegmentTree<E = number> implements Iterable<E> {
181
189
 
182
190
 
183
191
 
192
+
193
+
194
+
195
+
184
196
 
185
197
 
186
198
 
@@ -229,6 +241,10 @@ export declare class SegmentTree<E = number> implements Iterable<E> {
229
241
 
230
242
 
231
243
 
244
+
245
+
246
+
247
+
232
248
 
233
249
 
234
250
 
@@ -272,6 +288,10 @@ export declare class SegmentTree<E = number> implements Iterable<E> {
272
288
 
273
289
 
274
290
 
291
+
292
+
293
+
294
+
275
295
 
276
296
 
277
297
 
@@ -318,6 +338,10 @@ export declare class SegmentTree<E = number> implements Iterable<E> {
318
338
 
319
339
 
320
340
 
341
+
342
+
343
+
344
+
321
345
 
322
346
 
323
347