binary-tree-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.
- package/dist/cjs/index.cjs +194 -55
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs-legacy/index.cjs +194 -55
- package/dist/cjs-legacy/index.cjs.map +1 -1
- package/dist/esm/index.mjs +194 -55
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm-legacy/index.mjs +194 -55
- package/dist/esm-legacy/index.mjs.map +1 -1
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +50 -2
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +56 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +116 -15
- package/dist/types/data-structures/binary-tree/bst.d.ts +99 -3
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +79 -8
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +24 -0
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +520 -1
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +489 -1
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +393 -1
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +500 -1
- package/dist/types/data-structures/graph/directed-graph.d.ts +40 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +36 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +51 -6
- package/dist/types/data-structures/heap/heap.d.ts +98 -12
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +75 -0
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +61 -1
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +72 -0
- package/dist/types/data-structures/matrix/matrix.d.ts +32 -0
- package/dist/types/data-structures/queue/deque.d.ts +82 -0
- package/dist/types/data-structures/queue/queue.d.ts +61 -0
- package/dist/types/data-structures/stack/stack.d.ts +42 -2
- package/dist/types/data-structures/trie/trie.d.ts +48 -0
- package/dist/types/interfaces/binary-tree.d.ts +2 -3
- package/dist/umd/binary-tree-typed.js +194 -55
- package/dist/umd/binary-tree-typed.js.map +1 -1
- package/dist/umd/binary-tree-typed.min.js +5 -5
- package/dist/umd/binary-tree-typed.min.js.map +1 -1
- package/package.json +2 -2
- package/src/data-structures/binary-tree/avl-tree.ts +52 -5
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +56 -0
- package/src/data-structures/binary-tree/binary-tree.ts +167 -81
- package/src/data-structures/binary-tree/bst.ts +101 -7
- package/src/data-structures/binary-tree/red-black-tree.ts +82 -15
- package/src/data-structures/binary-tree/segment-tree.ts +24 -0
- package/src/data-structures/binary-tree/tree-map.ts +540 -3
- package/src/data-structures/binary-tree/tree-multi-map.ts +490 -2
- package/src/data-structures/binary-tree/tree-multi-set.ts +393 -1
- package/src/data-structures/binary-tree/tree-set.ts +520 -3
- package/src/data-structures/graph/directed-graph.ts +41 -1
- package/src/data-structures/graph/undirected-graph.ts +37 -1
- package/src/data-structures/hash/hash-map.ts +67 -12
- package/src/data-structures/heap/heap.ts +107 -19
- package/src/data-structures/linked-list/doubly-linked-list.ts +88 -0
- package/src/data-structures/linked-list/singly-linked-list.ts +61 -1
- package/src/data-structures/linked-list/skip-linked-list.ts +72 -0
- package/src/data-structures/matrix/matrix.ts +32 -0
- package/src/data-structures/queue/deque.ts +85 -0
- package/src/data-structures/queue/queue.ts +73 -0
- package/src/data-structures/stack/stack.ts +45 -5
- package/src/data-structures/trie/trie.ts +48 -0
- package/src/interfaces/binary-tree.ts +1 -9
|
@@ -105,6 +105,10 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
105
105
|
|
|
106
106
|
|
|
107
107
|
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
108
112
|
|
|
109
113
|
|
|
110
114
|
|
|
@@ -261,6 +265,26 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
261
265
|
|
|
262
266
|
|
|
263
267
|
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
264
288
|
|
|
265
289
|
|
|
266
290
|
|
|
@@ -433,6 +457,26 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
433
457
|
|
|
434
458
|
|
|
435
459
|
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
|
|
436
480
|
|
|
437
481
|
|
|
438
482
|
|
|
@@ -490,6 +534,10 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
490
534
|
|
|
491
535
|
|
|
492
536
|
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
|
|
493
541
|
|
|
494
542
|
|
|
495
543
|
|
|
@@ -641,6 +689,26 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
641
689
|
|
|
642
690
|
|
|
643
691
|
|
|
692
|
+
|
|
693
|
+
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
|
|
707
|
+
|
|
708
|
+
|
|
709
|
+
|
|
710
|
+
|
|
711
|
+
|
|
644
712
|
|
|
645
713
|
|
|
646
714
|
|
|
@@ -708,6 +776,10 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
708
776
|
|
|
709
777
|
|
|
710
778
|
|
|
779
|
+
|
|
780
|
+
|
|
781
|
+
|
|
782
|
+
|
|
711
783
|
|
|
712
784
|
|
|
713
785
|
|
|
@@ -880,6 +952,26 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
880
952
|
|
|
881
953
|
|
|
882
954
|
|
|
955
|
+
|
|
956
|
+
|
|
957
|
+
|
|
958
|
+
|
|
959
|
+
|
|
960
|
+
|
|
961
|
+
|
|
962
|
+
|
|
963
|
+
|
|
964
|
+
|
|
965
|
+
|
|
966
|
+
|
|
967
|
+
|
|
968
|
+
|
|
969
|
+
|
|
970
|
+
|
|
971
|
+
|
|
972
|
+
|
|
973
|
+
|
|
974
|
+
|
|
883
975
|
|
|
884
976
|
|
|
885
977
|
|
|
@@ -951,6 +1043,10 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
951
1043
|
|
|
952
1044
|
|
|
953
1045
|
|
|
1046
|
+
|
|
1047
|
+
|
|
1048
|
+
|
|
1049
|
+
|
|
954
1050
|
|
|
955
1051
|
|
|
956
1052
|
|
|
@@ -996,6 +1092,10 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
996
1092
|
|
|
997
1093
|
|
|
998
1094
|
|
|
1095
|
+
|
|
1096
|
+
|
|
1097
|
+
|
|
1098
|
+
|
|
999
1099
|
|
|
1000
1100
|
|
|
1001
1101
|
|
|
@@ -1152,6 +1252,26 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
1152
1252
|
|
|
1153
1253
|
|
|
1154
1254
|
|
|
1255
|
+
|
|
1256
|
+
|
|
1257
|
+
|
|
1258
|
+
|
|
1259
|
+
|
|
1260
|
+
|
|
1261
|
+
|
|
1262
|
+
|
|
1263
|
+
|
|
1264
|
+
|
|
1265
|
+
|
|
1266
|
+
|
|
1267
|
+
|
|
1268
|
+
|
|
1269
|
+
|
|
1270
|
+
|
|
1271
|
+
|
|
1272
|
+
|
|
1273
|
+
|
|
1274
|
+
|
|
1155
1275
|
|
|
1156
1276
|
|
|
1157
1277
|
|
|
@@ -1335,6 +1455,26 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
1335
1455
|
|
|
1336
1456
|
|
|
1337
1457
|
|
|
1458
|
+
|
|
1459
|
+
|
|
1460
|
+
|
|
1461
|
+
|
|
1462
|
+
|
|
1463
|
+
|
|
1464
|
+
|
|
1465
|
+
|
|
1466
|
+
|
|
1467
|
+
|
|
1468
|
+
|
|
1469
|
+
|
|
1470
|
+
|
|
1471
|
+
|
|
1472
|
+
|
|
1473
|
+
|
|
1474
|
+
|
|
1475
|
+
|
|
1476
|
+
|
|
1477
|
+
|
|
1338
1478
|
|
|
1339
1479
|
|
|
1340
1480
|
|
|
@@ -1391,6 +1531,10 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
1391
1531
|
|
|
1392
1532
|
|
|
1393
1533
|
|
|
1534
|
+
|
|
1535
|
+
|
|
1536
|
+
|
|
1537
|
+
|
|
1394
1538
|
|
|
1395
1539
|
|
|
1396
1540
|
|
|
@@ -1431,6 +1575,10 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
1431
1575
|
|
|
1432
1576
|
|
|
1433
1577
|
|
|
1578
|
+
|
|
1579
|
+
|
|
1580
|
+
|
|
1581
|
+
|
|
1434
1582
|
|
|
1435
1583
|
|
|
1436
1584
|
|
|
@@ -1598,6 +1746,26 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
1598
1746
|
|
|
1599
1747
|
|
|
1600
1748
|
|
|
1749
|
+
|
|
1750
|
+
|
|
1751
|
+
|
|
1752
|
+
|
|
1753
|
+
|
|
1754
|
+
|
|
1755
|
+
|
|
1756
|
+
|
|
1757
|
+
|
|
1758
|
+
|
|
1759
|
+
|
|
1760
|
+
|
|
1761
|
+
|
|
1762
|
+
|
|
1763
|
+
|
|
1764
|
+
|
|
1765
|
+
|
|
1766
|
+
|
|
1767
|
+
|
|
1768
|
+
|
|
1601
1769
|
|
|
1602
1770
|
|
|
1603
1771
|
|
|
@@ -1658,6 +1826,10 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
1658
1826
|
|
|
1659
1827
|
|
|
1660
1828
|
|
|
1829
|
+
|
|
1830
|
+
|
|
1831
|
+
|
|
1832
|
+
|
|
1661
1833
|
|
|
1662
1834
|
|
|
1663
1835
|
|
|
@@ -1699,6 +1871,10 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
1699
1871
|
|
|
1700
1872
|
|
|
1701
1873
|
|
|
1874
|
+
|
|
1875
|
+
|
|
1876
|
+
|
|
1877
|
+
|
|
1702
1878
|
|
|
1703
1879
|
|
|
1704
1880
|
|
|
@@ -1740,6 +1916,10 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
1740
1916
|
|
|
1741
1917
|
|
|
1742
1918
|
|
|
1919
|
+
|
|
1920
|
+
|
|
1921
|
+
|
|
1922
|
+
|
|
1743
1923
|
|
|
1744
1924
|
|
|
1745
1925
|
|
|
@@ -1785,6 +1965,10 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
1785
1965
|
|
|
1786
1966
|
|
|
1787
1967
|
|
|
1968
|
+
|
|
1969
|
+
|
|
1970
|
+
|
|
1971
|
+
|
|
1788
1972
|
|
|
1789
1973
|
|
|
1790
1974
|
|
|
@@ -1916,6 +2100,22 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
1916
2100
|
|
|
1917
2101
|
|
|
1918
2102
|
|
|
2103
|
+
|
|
2104
|
+
|
|
2105
|
+
|
|
2106
|
+
|
|
2107
|
+
|
|
2108
|
+
|
|
2109
|
+
|
|
2110
|
+
|
|
2111
|
+
|
|
2112
|
+
|
|
2113
|
+
|
|
2114
|
+
|
|
2115
|
+
|
|
2116
|
+
|
|
2117
|
+
|
|
2118
|
+
|
|
1919
2119
|
|
|
1920
2120
|
|
|
1921
2121
|
|
|
@@ -2058,6 +2258,22 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
2058
2258
|
|
|
2059
2259
|
|
|
2060
2260
|
|
|
2261
|
+
|
|
2262
|
+
|
|
2263
|
+
|
|
2264
|
+
|
|
2265
|
+
|
|
2266
|
+
|
|
2267
|
+
|
|
2268
|
+
|
|
2269
|
+
|
|
2270
|
+
|
|
2271
|
+
|
|
2272
|
+
|
|
2273
|
+
|
|
2274
|
+
|
|
2275
|
+
|
|
2276
|
+
|
|
2061
2277
|
|
|
2062
2278
|
|
|
2063
2279
|
|
|
@@ -2200,6 +2416,22 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
2200
2416
|
|
|
2201
2417
|
|
|
2202
2418
|
|
|
2419
|
+
|
|
2420
|
+
|
|
2421
|
+
|
|
2422
|
+
|
|
2423
|
+
|
|
2424
|
+
|
|
2425
|
+
|
|
2426
|
+
|
|
2427
|
+
|
|
2428
|
+
|
|
2429
|
+
|
|
2430
|
+
|
|
2431
|
+
|
|
2432
|
+
|
|
2433
|
+
|
|
2434
|
+
|
|
2203
2435
|
|
|
2204
2436
|
|
|
2205
2437
|
|
|
@@ -2341,6 +2573,22 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
2341
2573
|
|
|
2342
2574
|
|
|
2343
2575
|
|
|
2576
|
+
|
|
2577
|
+
|
|
2578
|
+
|
|
2579
|
+
|
|
2580
|
+
|
|
2581
|
+
|
|
2582
|
+
|
|
2583
|
+
|
|
2584
|
+
|
|
2585
|
+
|
|
2586
|
+
|
|
2587
|
+
|
|
2588
|
+
|
|
2589
|
+
|
|
2590
|
+
|
|
2591
|
+
|
|
2344
2592
|
|
|
2345
2593
|
|
|
2346
2594
|
|
|
@@ -2513,6 +2761,26 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
2513
2761
|
|
|
2514
2762
|
|
|
2515
2763
|
|
|
2764
|
+
|
|
2765
|
+
|
|
2766
|
+
|
|
2767
|
+
|
|
2768
|
+
|
|
2769
|
+
|
|
2770
|
+
|
|
2771
|
+
|
|
2772
|
+
|
|
2773
|
+
|
|
2774
|
+
|
|
2775
|
+
|
|
2776
|
+
|
|
2777
|
+
|
|
2778
|
+
|
|
2779
|
+
|
|
2780
|
+
|
|
2781
|
+
|
|
2782
|
+
|
|
2783
|
+
|
|
2516
2784
|
|
|
2517
2785
|
|
|
2518
2786
|
|
|
@@ -2690,6 +2958,26 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
2690
2958
|
|
|
2691
2959
|
|
|
2692
2960
|
|
|
2961
|
+
|
|
2962
|
+
|
|
2963
|
+
|
|
2964
|
+
|
|
2965
|
+
|
|
2966
|
+
|
|
2967
|
+
|
|
2968
|
+
|
|
2969
|
+
|
|
2970
|
+
|
|
2971
|
+
|
|
2972
|
+
|
|
2973
|
+
|
|
2974
|
+
|
|
2975
|
+
|
|
2976
|
+
|
|
2977
|
+
|
|
2978
|
+
|
|
2979
|
+
|
|
2980
|
+
|
|
2693
2981
|
|
|
2694
2982
|
|
|
2695
2983
|
|
|
@@ -2874,6 +3162,26 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
2874
3162
|
|
|
2875
3163
|
|
|
2876
3164
|
|
|
3165
|
+
|
|
3166
|
+
|
|
3167
|
+
|
|
3168
|
+
|
|
3169
|
+
|
|
3170
|
+
|
|
3171
|
+
|
|
3172
|
+
|
|
3173
|
+
|
|
3174
|
+
|
|
3175
|
+
|
|
3176
|
+
|
|
3177
|
+
|
|
3178
|
+
|
|
3179
|
+
|
|
3180
|
+
|
|
3181
|
+
|
|
3182
|
+
|
|
3183
|
+
|
|
3184
|
+
|
|
2877
3185
|
|
|
2878
3186
|
|
|
2879
3187
|
|
|
@@ -3053,6 +3361,26 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
3053
3361
|
|
|
3054
3362
|
|
|
3055
3363
|
|
|
3364
|
+
|
|
3365
|
+
|
|
3366
|
+
|
|
3367
|
+
|
|
3368
|
+
|
|
3369
|
+
|
|
3370
|
+
|
|
3371
|
+
|
|
3372
|
+
|
|
3373
|
+
|
|
3374
|
+
|
|
3375
|
+
|
|
3376
|
+
|
|
3377
|
+
|
|
3378
|
+
|
|
3379
|
+
|
|
3380
|
+
|
|
3381
|
+
|
|
3382
|
+
|
|
3383
|
+
|
|
3056
3384
|
|
|
3057
3385
|
|
|
3058
3386
|
|
|
@@ -3290,8 +3618,16 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
3290
3618
|
/**
|
|
3291
3619
|
* Get elements by rank range
|
|
3292
3620
|
|
|
3621
|
+
|
|
3622
|
+
|
|
3623
|
+
|
|
3624
|
+
|
|
3625
|
+
|
|
3626
|
+
|
|
3627
|
+
|
|
3628
|
+
|
|
3293
3629
|
* @example
|
|
3294
|
-
* // Pagination
|
|
3630
|
+
* // Pagination by position in tree order
|
|
3295
3631
|
* const tree = new TreeMultiSet<number>(
|
|
3296
3632
|
* [10, 20, 30, 40, 50, 60, 70, 80, 90],
|
|
3297
3633
|
* { enableOrderStatistic: true }
|
|
@@ -3314,6 +3650,26 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
3314
3650
|
|
|
3315
3651
|
|
|
3316
3652
|
|
|
3653
|
+
|
|
3654
|
+
|
|
3655
|
+
|
|
3656
|
+
|
|
3657
|
+
|
|
3658
|
+
|
|
3659
|
+
|
|
3660
|
+
|
|
3661
|
+
|
|
3662
|
+
|
|
3663
|
+
|
|
3664
|
+
|
|
3665
|
+
|
|
3666
|
+
|
|
3667
|
+
|
|
3668
|
+
|
|
3669
|
+
|
|
3670
|
+
|
|
3671
|
+
|
|
3672
|
+
|
|
3317
3673
|
|
|
3318
3674
|
* @example
|
|
3319
3675
|
* // Deep clone
|
|
@@ -3448,6 +3804,22 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
3448
3804
|
|
|
3449
3805
|
|
|
3450
3806
|
|
|
3807
|
+
|
|
3808
|
+
|
|
3809
|
+
|
|
3810
|
+
|
|
3811
|
+
|
|
3812
|
+
|
|
3813
|
+
|
|
3814
|
+
|
|
3815
|
+
|
|
3816
|
+
|
|
3817
|
+
|
|
3818
|
+
|
|
3819
|
+
|
|
3820
|
+
|
|
3821
|
+
|
|
3822
|
+
|
|
3451
3823
|
|
|
3452
3824
|
|
|
3453
3825
|
|
|
@@ -3623,6 +3995,26 @@ export class TreeMultiSet<K = any, R = K> implements Iterable<K> {
|
|
|
3623
3995
|
|
|
3624
3996
|
|
|
3625
3997
|
|
|
3998
|
+
|
|
3999
|
+
|
|
4000
|
+
|
|
4001
|
+
|
|
4002
|
+
|
|
4003
|
+
|
|
4004
|
+
|
|
4005
|
+
|
|
4006
|
+
|
|
4007
|
+
|
|
4008
|
+
|
|
4009
|
+
|
|
4010
|
+
|
|
4011
|
+
|
|
4012
|
+
|
|
4013
|
+
|
|
4014
|
+
|
|
4015
|
+
|
|
4016
|
+
|
|
4017
|
+
|
|
3626
4018
|
|
|
3627
4019
|
|
|
3628
4020
|
|