binary-tree-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.
- package/dist/cjs/index.cjs +146 -52
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs-legacy/index.cjs +145 -51
- package/dist/cjs-legacy/index.cjs.map +1 -1
- package/dist/esm/index.mjs +146 -53
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm-legacy/index.mjs +145 -52
- package/dist/esm-legacy/index.mjs.map +1 -1
- package/dist/types/common/error.d.ts +9 -0
- package/dist/types/common/index.d.ts +1 -1
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +36 -0
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +42 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +77 -2
- package/dist/types/data-structures/binary-tree/bst.d.ts +171 -0
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +57 -0
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +18 -0
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +409 -0
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +411 -6
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +339 -6
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +391 -0
- package/dist/types/data-structures/graph/directed-graph.d.ts +30 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +27 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +33 -0
- package/dist/types/data-structures/heap/heap.d.ts +42 -0
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +51 -0
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +45 -0
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +54 -0
- package/dist/types/data-structures/matrix/matrix.d.ts +24 -0
- package/dist/types/data-structures/queue/deque.d.ts +45 -0
- package/dist/types/data-structures/queue/queue.d.ts +36 -0
- package/dist/types/data-structures/stack/stack.d.ts +30 -0
- package/dist/types/data-structures/trie/trie.d.ts +36 -0
- package/dist/types/types/data-structures/binary-tree/bst.d.ts +1 -0
- package/dist/types/types/data-structures/binary-tree/tree-map.d.ts +5 -0
- package/dist/types/types/data-structures/binary-tree/tree-multi-set.d.ts +4 -0
- package/dist/types/types/data-structures/binary-tree/tree-set.d.ts +4 -0
- package/dist/umd/binary-tree-typed.js +143 -50
- package/dist/umd/binary-tree-typed.js.map +1 -1
- package/dist/umd/binary-tree-typed.min.js +3 -3
- package/dist/umd/binary-tree-typed.min.js.map +1 -1
- package/package.json +2 -2
- package/src/common/error.ts +19 -1
- package/src/common/index.ts +1 -1
- package/src/data-structures/base/iterable-element-base.ts +3 -2
- package/src/data-structures/binary-tree/avl-tree.ts +47 -0
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +46 -4
- package/src/data-structures/binary-tree/binary-tree.ts +79 -4
- package/src/data-structures/binary-tree/bst.ts +441 -6
- package/src/data-structures/binary-tree/red-black-tree.ts +73 -0
- package/src/data-structures/binary-tree/segment-tree.ts +18 -0
- package/src/data-structures/binary-tree/tree-map.ts +434 -9
- package/src/data-structures/binary-tree/tree-multi-map.ts +426 -5
- package/src/data-structures/binary-tree/tree-multi-set.ts +350 -6
- package/src/data-structures/binary-tree/tree-set.ts +410 -8
- package/src/data-structures/graph/abstract-graph.ts +2 -2
- package/src/data-structures/graph/directed-graph.ts +30 -0
- package/src/data-structures/graph/undirected-graph.ts +27 -0
- package/src/data-structures/hash/hash-map.ts +35 -4
- package/src/data-structures/heap/heap.ts +46 -4
- package/src/data-structures/heap/max-heap.ts +2 -2
- package/src/data-structures/linked-list/doubly-linked-list.ts +51 -0
- package/src/data-structures/linked-list/singly-linked-list.ts +45 -0
- package/src/data-structures/linked-list/skip-linked-list.ts +59 -5
- package/src/data-structures/matrix/matrix.ts +33 -9
- package/src/data-structures/priority-queue/max-priority-queue.ts +2 -2
- package/src/data-structures/queue/deque.ts +45 -0
- package/src/data-structures/queue/queue.ts +36 -0
- package/src/data-structures/stack/stack.ts +30 -0
- package/src/data-structures/trie/trie.ts +38 -2
- package/src/types/data-structures/binary-tree/bst.ts +1 -0
- package/src/types/data-structures/binary-tree/tree-map.ts +6 -0
- package/src/types/data-structures/binary-tree/tree-multi-set.ts +5 -0
- package/src/types/data-structures/binary-tree/tree-set.ts +5 -0
|
@@ -178,6 +178,21 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
178
178
|
|
|
179
179
|
|
|
180
180
|
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
181
196
|
|
|
182
197
|
|
|
183
198
|
|
|
@@ -329,6 +344,21 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
329
344
|
|
|
330
345
|
|
|
331
346
|
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
332
362
|
|
|
333
363
|
|
|
334
364
|
|
|
@@ -375,6 +405,9 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
375
405
|
|
|
376
406
|
|
|
377
407
|
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
|
|
378
411
|
|
|
379
412
|
|
|
380
413
|
|
|
@@ -409,6 +442,9 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
409
442
|
|
|
410
443
|
|
|
411
444
|
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
|
|
412
448
|
|
|
413
449
|
|
|
414
450
|
|
|
@@ -584,6 +620,24 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
584
620
|
|
|
585
621
|
|
|
586
622
|
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
|
|
634
|
+
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
|
|
587
641
|
|
|
588
642
|
|
|
589
643
|
|
|
@@ -773,6 +827,24 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
773
827
|
|
|
774
828
|
|
|
775
829
|
|
|
830
|
+
|
|
831
|
+
|
|
832
|
+
|
|
833
|
+
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
|
|
837
|
+
|
|
838
|
+
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
|
|
843
|
+
|
|
844
|
+
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
|
|
776
848
|
|
|
777
849
|
|
|
778
850
|
|
|
@@ -924,6 +996,21 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
924
996
|
|
|
925
997
|
|
|
926
998
|
|
|
999
|
+
|
|
1000
|
+
|
|
1001
|
+
|
|
1002
|
+
|
|
1003
|
+
|
|
1004
|
+
|
|
1005
|
+
|
|
1006
|
+
|
|
1007
|
+
|
|
1008
|
+
|
|
1009
|
+
|
|
1010
|
+
|
|
1011
|
+
|
|
1012
|
+
|
|
1013
|
+
|
|
927
1014
|
|
|
928
1015
|
|
|
929
1016
|
|
|
@@ -1109,6 +1196,24 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
1109
1196
|
|
|
1110
1197
|
|
|
1111
1198
|
|
|
1199
|
+
|
|
1200
|
+
|
|
1201
|
+
|
|
1202
|
+
|
|
1203
|
+
|
|
1204
|
+
|
|
1205
|
+
|
|
1206
|
+
|
|
1207
|
+
|
|
1208
|
+
|
|
1209
|
+
|
|
1210
|
+
|
|
1211
|
+
|
|
1212
|
+
|
|
1213
|
+
|
|
1214
|
+
|
|
1215
|
+
|
|
1216
|
+
|
|
1112
1217
|
|
|
1113
1218
|
|
|
1114
1219
|
|
|
@@ -1299,6 +1404,24 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
1299
1404
|
|
|
1300
1405
|
|
|
1301
1406
|
|
|
1407
|
+
|
|
1408
|
+
|
|
1409
|
+
|
|
1410
|
+
|
|
1411
|
+
|
|
1412
|
+
|
|
1413
|
+
|
|
1414
|
+
|
|
1415
|
+
|
|
1416
|
+
|
|
1417
|
+
|
|
1418
|
+
|
|
1419
|
+
|
|
1420
|
+
|
|
1421
|
+
|
|
1422
|
+
|
|
1423
|
+
|
|
1424
|
+
|
|
1302
1425
|
|
|
1303
1426
|
|
|
1304
1427
|
|
|
@@ -1349,6 +1472,9 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
1349
1472
|
|
|
1350
1473
|
|
|
1351
1474
|
|
|
1475
|
+
|
|
1476
|
+
|
|
1477
|
+
|
|
1352
1478
|
|
|
1353
1479
|
|
|
1354
1480
|
|
|
@@ -1383,6 +1509,9 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
1383
1509
|
|
|
1384
1510
|
|
|
1385
1511
|
|
|
1512
|
+
|
|
1513
|
+
|
|
1514
|
+
|
|
1386
1515
|
|
|
1387
1516
|
|
|
1388
1517
|
|
|
@@ -1418,6 +1547,9 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
1418
1547
|
|
|
1419
1548
|
|
|
1420
1549
|
|
|
1550
|
+
|
|
1551
|
+
|
|
1552
|
+
|
|
1421
1553
|
|
|
1422
1554
|
|
|
1423
1555
|
|
|
@@ -1567,6 +1699,21 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
1567
1699
|
|
|
1568
1700
|
|
|
1569
1701
|
|
|
1702
|
+
|
|
1703
|
+
|
|
1704
|
+
|
|
1705
|
+
|
|
1706
|
+
|
|
1707
|
+
|
|
1708
|
+
|
|
1709
|
+
|
|
1710
|
+
|
|
1711
|
+
|
|
1712
|
+
|
|
1713
|
+
|
|
1714
|
+
|
|
1715
|
+
|
|
1716
|
+
|
|
1570
1717
|
|
|
1571
1718
|
|
|
1572
1719
|
|
|
@@ -1721,6 +1868,21 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
1721
1868
|
|
|
1722
1869
|
|
|
1723
1870
|
|
|
1871
|
+
|
|
1872
|
+
|
|
1873
|
+
|
|
1874
|
+
|
|
1875
|
+
|
|
1876
|
+
|
|
1877
|
+
|
|
1878
|
+
|
|
1879
|
+
|
|
1880
|
+
|
|
1881
|
+
|
|
1882
|
+
|
|
1883
|
+
|
|
1884
|
+
|
|
1885
|
+
|
|
1724
1886
|
|
|
1725
1887
|
|
|
1726
1888
|
|
|
@@ -1767,6 +1929,9 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
1767
1929
|
|
|
1768
1930
|
|
|
1769
1931
|
|
|
1932
|
+
|
|
1933
|
+
|
|
1934
|
+
|
|
1770
1935
|
|
|
1771
1936
|
|
|
1772
1937
|
|
|
@@ -1801,6 +1966,9 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
1801
1966
|
|
|
1802
1967
|
|
|
1803
1968
|
|
|
1969
|
+
|
|
1970
|
+
|
|
1971
|
+
|
|
1804
1972
|
|
|
1805
1973
|
|
|
1806
1974
|
|
|
@@ -1835,6 +2003,9 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
1835
2003
|
|
|
1836
2004
|
|
|
1837
2005
|
|
|
2006
|
+
|
|
2007
|
+
|
|
2008
|
+
|
|
1838
2009
|
|
|
1839
2010
|
|
|
1840
2011
|
|
|
@@ -1900,6 +2071,12 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
1900
2071
|
|
|
1901
2072
|
|
|
1902
2073
|
|
|
2074
|
+
|
|
2075
|
+
|
|
2076
|
+
|
|
2077
|
+
|
|
2078
|
+
|
|
2079
|
+
|
|
1903
2080
|
|
|
1904
2081
|
|
|
1905
2082
|
|
|
@@ -1967,6 +2144,12 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
1967
2144
|
|
|
1968
2145
|
|
|
1969
2146
|
|
|
2147
|
+
|
|
2148
|
+
|
|
2149
|
+
|
|
2150
|
+
|
|
2151
|
+
|
|
2152
|
+
|
|
1970
2153
|
|
|
1971
2154
|
|
|
1972
2155
|
|
|
@@ -2005,6 +2188,9 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
2005
2188
|
|
|
2006
2189
|
|
|
2007
2190
|
|
|
2191
|
+
|
|
2192
|
+
|
|
2193
|
+
|
|
2008
2194
|
|
|
2009
2195
|
|
|
2010
2196
|
|
|
@@ -2042,6 +2228,9 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
2042
2228
|
|
|
2043
2229
|
|
|
2044
2230
|
|
|
2231
|
+
|
|
2232
|
+
|
|
2233
|
+
|
|
2045
2234
|
|
|
2046
2235
|
|
|
2047
2236
|
|
|
@@ -2188,6 +2377,21 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
2188
2377
|
|
|
2189
2378
|
|
|
2190
2379
|
|
|
2380
|
+
|
|
2381
|
+
|
|
2382
|
+
|
|
2383
|
+
|
|
2384
|
+
|
|
2385
|
+
|
|
2386
|
+
|
|
2387
|
+
|
|
2388
|
+
|
|
2389
|
+
|
|
2390
|
+
|
|
2391
|
+
|
|
2392
|
+
|
|
2393
|
+
|
|
2394
|
+
|
|
2191
2395
|
|
|
2192
2396
|
|
|
2193
2397
|
|
|
@@ -2346,6 +2550,21 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
2346
2550
|
|
|
2347
2551
|
|
|
2348
2552
|
|
|
2553
|
+
|
|
2554
|
+
|
|
2555
|
+
|
|
2556
|
+
|
|
2557
|
+
|
|
2558
|
+
|
|
2559
|
+
|
|
2560
|
+
|
|
2561
|
+
|
|
2562
|
+
|
|
2563
|
+
|
|
2564
|
+
|
|
2565
|
+
|
|
2566
|
+
|
|
2567
|
+
|
|
2349
2568
|
|
|
2350
2569
|
|
|
2351
2570
|
|
|
@@ -2475,6 +2694,18 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
2475
2694
|
|
|
2476
2695
|
|
|
2477
2696
|
|
|
2697
|
+
|
|
2698
|
+
|
|
2699
|
+
|
|
2700
|
+
|
|
2701
|
+
|
|
2702
|
+
|
|
2703
|
+
|
|
2704
|
+
|
|
2705
|
+
|
|
2706
|
+
|
|
2707
|
+
|
|
2708
|
+
|
|
2478
2709
|
|
|
2479
2710
|
|
|
2480
2711
|
|
|
@@ -2600,6 +2831,18 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
2600
2831
|
|
|
2601
2832
|
|
|
2602
2833
|
|
|
2834
|
+
|
|
2835
|
+
|
|
2836
|
+
|
|
2837
|
+
|
|
2838
|
+
|
|
2839
|
+
|
|
2840
|
+
|
|
2841
|
+
|
|
2842
|
+
|
|
2843
|
+
|
|
2844
|
+
|
|
2845
|
+
|
|
2603
2846
|
|
|
2604
2847
|
|
|
2605
2848
|
|
|
@@ -2751,6 +2994,21 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
2751
2994
|
|
|
2752
2995
|
|
|
2753
2996
|
|
|
2997
|
+
|
|
2998
|
+
|
|
2999
|
+
|
|
3000
|
+
|
|
3001
|
+
|
|
3002
|
+
|
|
3003
|
+
|
|
3004
|
+
|
|
3005
|
+
|
|
3006
|
+
|
|
3007
|
+
|
|
3008
|
+
|
|
3009
|
+
|
|
3010
|
+
|
|
3011
|
+
|
|
2754
3012
|
|
|
2755
3013
|
|
|
2756
3014
|
|
|
@@ -2904,6 +3162,21 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
2904
3162
|
|
|
2905
3163
|
|
|
2906
3164
|
|
|
3165
|
+
|
|
3166
|
+
|
|
3167
|
+
|
|
3168
|
+
|
|
3169
|
+
|
|
3170
|
+
|
|
3171
|
+
|
|
3172
|
+
|
|
3173
|
+
|
|
3174
|
+
|
|
3175
|
+
|
|
3176
|
+
|
|
3177
|
+
|
|
3178
|
+
|
|
3179
|
+
|
|
2907
3180
|
|
|
2908
3181
|
|
|
2909
3182
|
|
|
@@ -3060,6 +3333,21 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
3060
3333
|
|
|
3061
3334
|
|
|
3062
3335
|
|
|
3336
|
+
|
|
3337
|
+
|
|
3338
|
+
|
|
3339
|
+
|
|
3340
|
+
|
|
3341
|
+
|
|
3342
|
+
|
|
3343
|
+
|
|
3344
|
+
|
|
3345
|
+
|
|
3346
|
+
|
|
3347
|
+
|
|
3348
|
+
|
|
3349
|
+
|
|
3350
|
+
|
|
3063
3351
|
|
|
3064
3352
|
|
|
3065
3353
|
|
|
@@ -3216,6 +3504,21 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
3216
3504
|
|
|
3217
3505
|
|
|
3218
3506
|
|
|
3507
|
+
|
|
3508
|
+
|
|
3509
|
+
|
|
3510
|
+
|
|
3511
|
+
|
|
3512
|
+
|
|
3513
|
+
|
|
3514
|
+
|
|
3515
|
+
|
|
3516
|
+
|
|
3517
|
+
|
|
3518
|
+
|
|
3519
|
+
|
|
3520
|
+
|
|
3521
|
+
|
|
3219
3522
|
|
|
3220
3523
|
|
|
3221
3524
|
|
|
@@ -3370,6 +3673,21 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
3370
3673
|
|
|
3371
3674
|
|
|
3372
3675
|
|
|
3676
|
+
|
|
3677
|
+
|
|
3678
|
+
|
|
3679
|
+
|
|
3680
|
+
|
|
3681
|
+
|
|
3682
|
+
|
|
3683
|
+
|
|
3684
|
+
|
|
3685
|
+
|
|
3686
|
+
|
|
3687
|
+
|
|
3688
|
+
|
|
3689
|
+
|
|
3690
|
+
|
|
3373
3691
|
|
|
3374
3692
|
|
|
3375
3693
|
|
|
@@ -3517,6 +3835,21 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
3517
3835
|
|
|
3518
3836
|
|
|
3519
3837
|
|
|
3838
|
+
|
|
3839
|
+
|
|
3840
|
+
|
|
3841
|
+
|
|
3842
|
+
|
|
3843
|
+
|
|
3844
|
+
|
|
3845
|
+
|
|
3846
|
+
|
|
3847
|
+
|
|
3848
|
+
|
|
3849
|
+
|
|
3850
|
+
|
|
3851
|
+
|
|
3852
|
+
|
|
3520
3853
|
|
|
3521
3854
|
|
|
3522
3855
|
|
|
@@ -3644,6 +3977,18 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
3644
3977
|
|
|
3645
3978
|
|
|
3646
3979
|
|
|
3980
|
+
|
|
3981
|
+
|
|
3982
|
+
|
|
3983
|
+
|
|
3984
|
+
|
|
3985
|
+
|
|
3986
|
+
|
|
3987
|
+
|
|
3988
|
+
|
|
3989
|
+
|
|
3990
|
+
|
|
3991
|
+
|
|
3647
3992
|
|
|
3648
3993
|
|
|
3649
3994
|
|
|
@@ -3799,6 +4144,19 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
3799
4144
|
|
|
3800
4145
|
|
|
3801
4146
|
|
|
4147
|
+
|
|
4148
|
+
|
|
4149
|
+
|
|
4150
|
+
|
|
4151
|
+
|
|
4152
|
+
|
|
4153
|
+
|
|
4154
|
+
|
|
4155
|
+
|
|
4156
|
+
|
|
4157
|
+
|
|
4158
|
+
|
|
4159
|
+
|
|
3802
4160
|
|
|
3803
4161
|
|
|
3804
4162
|
|
|
@@ -3814,13 +4172,60 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
3814
4172
|
|
|
3815
4173
|
|
|
3816
4174
|
* @example
|
|
3817
|
-
* //
|
|
3818
|
-
* const
|
|
3819
|
-
*
|
|
3820
|
-
*
|
|
3821
|
-
*
|
|
3822
|
-
* console.log(mm.has(1)); // true;
|
|
4175
|
+
* // Order-statistic on BST
|
|
4176
|
+
* const tree = new TreeMultiMap<number>([30, 10, 50, 20, 40], { enableOrderStatistic: true });
|
|
4177
|
+
* console.log(tree.getByRank(0)); // 10;
|
|
4178
|
+
* console.log(tree.getByRank(4)); // 50;
|
|
4179
|
+
* console.log(tree.getRank(30)); // 2;
|
|
3823
4180
|
*/
|
|
4181
|
+
getByRank(k: number): [K, V[]] | undefined;
|
|
4182
|
+
/**
|
|
4183
|
+
* Get the rank of a key in sorted order
|
|
4184
|
+
* @example
|
|
4185
|
+
* // Get the rank of a key in sorted order
|
|
4186
|
+
* const tree = new TreeMultiMap<number>(
|
|
4187
|
+
* [10, 20, 30, 40, 50],
|
|
4188
|
+
* { enableOrderStatistic: true }
|
|
4189
|
+
* );
|
|
4190
|
+
* console.log(tree.getRank(10)); // 0; // smallest → rank 0
|
|
4191
|
+
* console.log(tree.getRank(30)); // 2; // 2 elements before 30 in tree order
|
|
4192
|
+
* console.log(tree.getRank(50)); // 4; // largest → rank 4
|
|
4193
|
+
* console.log(tree.getRank(25)); // 2;
|
|
4194
|
+
*/
|
|
4195
|
+
getRank(key: K): number;
|
|
4196
|
+
/**
|
|
4197
|
+
* Get elements by rank range
|
|
4198
|
+
|
|
4199
|
+
* @example
|
|
4200
|
+
* // Pagination with rangeByRank
|
|
4201
|
+
* const tree = new TreeMultiMap<number>(
|
|
4202
|
+
* [10, 20, 30, 40, 50, 60, 70, 80, 90],
|
|
4203
|
+
* { enableOrderStatistic: true }
|
|
4204
|
+
* );
|
|
4205
|
+
* const pageSize = 3;
|
|
4206
|
+
*
|
|
4207
|
+
* // Page 1
|
|
4208
|
+
* console.log(tree.rangeByRank(0, pageSize - 1)); // [10, 20, 30];
|
|
4209
|
+
* // Page 2
|
|
4210
|
+
* console.log(tree.rangeByRank(pageSize, 2 * pageSize - 1)); // [40, 50, 60];
|
|
4211
|
+
* // Page 3
|
|
4212
|
+
* console.log(tree.rangeByRank(2 * pageSize, 3 * pageSize - 1)); // [70, 80, 90];
|
|
4213
|
+
*/
|
|
4214
|
+
rangeByRank(start: number, end: number): Array<[K, V[]]>;
|
|
4215
|
+
/**
|
|
4216
|
+
* Deep copy
|
|
4217
|
+
|
|
4218
|
+
|
|
4219
|
+
|
|
4220
|
+
|
|
4221
|
+
* @example
|
|
4222
|
+
* // Deep clone
|
|
4223
|
+
* const mm = new TreeMultiMap<number, string>();
|
|
4224
|
+
* mm.add(1, 'a');
|
|
4225
|
+
* const copy = mm.clone();
|
|
4226
|
+
* copy.delete(1);
|
|
4227
|
+
* console.log(mm.has(1)); // true;
|
|
4228
|
+
*/
|
|
3824
4229
|
clone(): TreeMultiMap<K, V, R>;
|
|
3825
4230
|
/**
|
|
3826
4231
|
* Expose comparator for advanced usage/testing (read-only).
|