binary-tree-typed 2.5.3 → 2.6.0

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 (61) hide show
  1. package/dist/cjs/index.cjs +126 -0
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs-legacy/index.cjs +126 -0
  4. package/dist/cjs-legacy/index.cjs.map +1 -1
  5. package/dist/esm/index.mjs +126 -0
  6. package/dist/esm/index.mjs.map +1 -1
  7. package/dist/esm-legacy/index.mjs +126 -0
  8. package/dist/esm-legacy/index.mjs.map +1 -1
  9. package/dist/types/data-structures/base/iterable-element-base.d.ts +17 -0
  10. package/dist/types/data-structures/base/linear-base.d.ts +6 -0
  11. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +36 -0
  12. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +42 -0
  13. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +75 -0
  14. package/dist/types/data-structures/binary-tree/bst.d.ts +72 -0
  15. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +57 -0
  16. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +18 -0
  17. package/dist/types/data-structures/binary-tree/tree-map.d.ts +375 -0
  18. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +389 -0
  19. package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +330 -0
  20. package/dist/types/data-structures/binary-tree/tree-set.d.ts +438 -0
  21. package/dist/types/data-structures/graph/directed-graph.d.ts +30 -0
  22. package/dist/types/data-structures/graph/undirected-graph.d.ts +27 -0
  23. package/dist/types/data-structures/hash/hash-map.d.ts +33 -0
  24. package/dist/types/data-structures/heap/heap.d.ts +42 -0
  25. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +75 -2
  26. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +45 -0
  27. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +54 -0
  28. package/dist/types/data-structures/matrix/matrix.d.ts +24 -0
  29. package/dist/types/data-structures/queue/deque.d.ts +90 -1
  30. package/dist/types/data-structures/queue/queue.d.ts +36 -0
  31. package/dist/types/data-structures/stack/stack.d.ts +30 -0
  32. package/dist/types/data-structures/trie/trie.d.ts +36 -0
  33. package/dist/umd/binary-tree-typed.js +126 -0
  34. package/dist/umd/binary-tree-typed.js.map +1 -1
  35. package/dist/umd/binary-tree-typed.min.js +1 -1
  36. package/dist/umd/binary-tree-typed.min.js.map +1 -1
  37. package/package.json +2 -2
  38. package/src/data-structures/base/iterable-element-base.ts +32 -0
  39. package/src/data-structures/base/linear-base.ts +11 -0
  40. package/src/data-structures/binary-tree/avl-tree.ts +36 -0
  41. package/src/data-structures/binary-tree/binary-indexed-tree.ts +42 -0
  42. package/src/data-structures/binary-tree/binary-tree.ts +75 -0
  43. package/src/data-structures/binary-tree/bst.ts +72 -0
  44. package/src/data-structures/binary-tree/red-black-tree.ts +57 -0
  45. package/src/data-structures/binary-tree/segment-tree.ts +18 -0
  46. package/src/data-structures/binary-tree/tree-map.ts +375 -0
  47. package/src/data-structures/binary-tree/tree-multi-map.ts +392 -0
  48. package/src/data-structures/binary-tree/tree-multi-set.ts +336 -0
  49. package/src/data-structures/binary-tree/tree-set.ts +492 -0
  50. package/src/data-structures/graph/directed-graph.ts +30 -0
  51. package/src/data-structures/graph/undirected-graph.ts +27 -0
  52. package/src/data-structures/hash/hash-map.ts +33 -0
  53. package/src/data-structures/heap/heap.ts +42 -0
  54. package/src/data-structures/linked-list/doubly-linked-list.ts +90 -2
  55. package/src/data-structures/linked-list/singly-linked-list.ts +45 -0
  56. package/src/data-structures/linked-list/skip-linked-list.ts +54 -0
  57. package/src/data-structures/matrix/matrix.ts +24 -0
  58. package/src/data-structures/queue/deque.ts +103 -1
  59. package/src/data-structures/queue/queue.ts +36 -0
  60. package/src/data-structures/stack/stack.ts +30 -0
  61. package/src/data-structures/trie/trie.ts +36 -0
@@ -69,6 +69,9 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
69
69
 
70
70
 
71
71
 
72
+
73
+
74
+
72
75
 
73
76
 
74
77
 
@@ -246,6 +249,21 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
246
249
 
247
250
 
248
251
 
252
+
253
+
254
+
255
+
256
+
257
+
258
+
259
+
260
+
261
+
262
+
263
+
264
+
265
+
266
+
249
267
 
250
268
 
251
269
 
@@ -435,6 +453,21 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
435
453
 
436
454
 
437
455
 
456
+
457
+
458
+
459
+
460
+
461
+
462
+
463
+
464
+
465
+
466
+
467
+
468
+
469
+
470
+
438
471
 
439
472
 
440
473
 
@@ -488,6 +521,9 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
488
521
 
489
522
 
490
523
 
524
+
525
+
526
+
491
527
 
492
528
 
493
529
 
@@ -659,6 +695,21 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
659
695
 
660
696
 
661
697
 
698
+
699
+
700
+
701
+
702
+
703
+
704
+
705
+
706
+
707
+
708
+
709
+
710
+
711
+
712
+
662
713
 
663
714
 
664
715
 
@@ -715,6 +766,9 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
715
766
 
716
767
 
717
768
 
769
+
770
+
771
+
718
772
 
719
773
 
720
774
 
@@ -895,6 +949,21 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
895
949
 
896
950
 
897
951
 
952
+
953
+
954
+
955
+
956
+
957
+
958
+
959
+
960
+
961
+
962
+
963
+
964
+
965
+
966
+
898
967
 
899
968
 
900
969
 
@@ -949,6 +1018,9 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
949
1018
 
950
1019
 
951
1020
 
1021
+
1022
+
1023
+
952
1024
 
953
1025
 
954
1026
 
@@ -990,6 +1062,9 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
990
1062
 
991
1063
 
992
1064
 
1065
+
1066
+
1067
+
993
1068
 
994
1069
 
995
1070
 
@@ -1167,6 +1242,21 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
1167
1242
 
1168
1243
 
1169
1244
 
1245
+
1246
+
1247
+
1248
+
1249
+
1250
+
1251
+
1252
+
1253
+
1254
+
1255
+
1256
+
1257
+
1258
+
1259
+
1170
1260
 
1171
1261
 
1172
1262
 
@@ -1195,6 +1285,42 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
1195
1285
  * @remarks Time O(size), Space O(1) where size is total occurrences
1196
1286
  */
1197
1287
  [Symbol.iterator](): Iterator<K>;
1288
+ /**
1289
+ * Iterate over all elements with multiplicity (Set-compatible, alias for `[Symbol.iterator]`).
1290
+ * @remarks Each key is yielded `count(key)` times. Time O(size), Space O(1) per step.
1291
+
1292
+
1293
+
1294
+
1295
+
1296
+
1297
+
1298
+
1299
+ * @example
1300
+ * // Iterate with multiplicity
1301
+ * const ms = new TreeMultiSet<number>();
1302
+ * ms.add(1); ms.add(1); ms.add(2); ms.add(3); ms.add(3); ms.add(3);
1303
+ * console.log([...ms.keys()]); // [1, 1, 2, 3, 3, 3];
1304
+ */
1305
+ keys(): IterableIterator<K>;
1306
+ /**
1307
+ * Iterate over all elements with multiplicity (Set-compatible, alias for `[Symbol.iterator]`).
1308
+ * @remarks Each key is yielded `count(key)` times. Time O(size), Space O(1) per step.
1309
+
1310
+
1311
+
1312
+
1313
+
1314
+
1315
+
1316
+
1317
+ * @example
1318
+ * // Iterate with multiplicity
1319
+ * const ms = new TreeMultiSet<number>();
1320
+ * ms.add(5); ms.add(5); ms.add(10);
1321
+ * console.log([...ms.values()]); // [5, 5, 10];
1322
+ */
1323
+ values(): IterableIterator<K>;
1198
1324
  /**
1199
1325
  * Returns an array with all elements (expanded).
1200
1326
  * @remarks Time O(size), Space O(size)
@@ -1360,6 +1486,21 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
1360
1486
 
1361
1487
 
1362
1488
 
1489
+
1490
+
1491
+
1492
+
1493
+
1494
+
1495
+
1496
+
1497
+
1498
+
1499
+
1500
+
1501
+
1502
+
1503
+
1363
1504
 
1364
1505
 
1365
1506
 
@@ -1413,6 +1554,9 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
1413
1554
 
1414
1555
 
1415
1556
 
1557
+
1558
+
1559
+
1416
1560
 
1417
1561
 
1418
1562
 
@@ -1454,6 +1598,9 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
1454
1598
 
1455
1599
 
1456
1600
 
1601
+
1602
+
1603
+
1457
1604
 
1458
1605
 
1459
1606
 
@@ -1637,6 +1784,21 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
1637
1784
 
1638
1785
 
1639
1786
 
1787
+
1788
+
1789
+
1790
+
1791
+
1792
+
1793
+
1794
+
1795
+
1796
+
1797
+
1798
+
1799
+
1800
+
1801
+
1640
1802
 
1641
1803
 
1642
1804
 
@@ -1691,6 +1853,9 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
1691
1853
 
1692
1854
 
1693
1855
 
1856
+
1857
+
1858
+
1694
1859
 
1695
1860
 
1696
1861
 
@@ -1733,6 +1898,9 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
1733
1898
 
1734
1899
 
1735
1900
 
1901
+
1902
+
1903
+
1736
1904
 
1737
1905
 
1738
1906
 
@@ -1775,6 +1943,9 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
1775
1943
 
1776
1944
 
1777
1945
 
1946
+
1947
+
1948
+
1778
1949
 
1779
1950
 
1780
1951
 
@@ -1818,6 +1989,9 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
1818
1989
 
1819
1990
 
1820
1991
 
1992
+
1993
+
1994
+
1821
1995
 
1822
1996
 
1823
1997
 
@@ -1962,6 +2136,18 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
1962
2136
 
1963
2137
 
1964
2138
 
2139
+
2140
+
2141
+
2142
+
2143
+
2144
+
2145
+
2146
+
2147
+
2148
+
2149
+
2150
+
1965
2151
 
1966
2152
 
1967
2153
 
@@ -2116,6 +2302,18 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
2116
2302
 
2117
2303
 
2118
2304
 
2305
+
2306
+
2307
+
2308
+
2309
+
2310
+
2311
+
2312
+
2313
+
2314
+
2315
+
2316
+
2119
2317
 
2120
2318
 
2121
2319
 
@@ -2270,6 +2468,18 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
2270
2468
 
2271
2469
 
2272
2470
 
2471
+
2472
+
2473
+
2474
+
2475
+
2476
+
2477
+
2478
+
2479
+
2480
+
2481
+
2482
+
2273
2483
 
2274
2484
 
2275
2485
 
@@ -2423,6 +2633,18 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
2423
2633
 
2424
2634
 
2425
2635
 
2636
+
2637
+
2638
+
2639
+
2640
+
2641
+
2642
+
2643
+
2644
+
2645
+
2646
+
2647
+
2426
2648
 
2427
2649
 
2428
2650
 
@@ -2610,6 +2832,21 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
2610
2832
 
2611
2833
 
2612
2834
 
2835
+
2836
+
2837
+
2838
+
2839
+
2840
+
2841
+
2842
+
2843
+
2844
+
2845
+
2846
+
2847
+
2848
+
2849
+
2613
2850
 
2614
2851
 
2615
2852
 
@@ -2802,6 +3039,21 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
2802
3039
 
2803
3040
 
2804
3041
 
3042
+
3043
+
3044
+
3045
+
3046
+
3047
+
3048
+
3049
+
3050
+
3051
+
3052
+
3053
+
3054
+
3055
+
3056
+
2805
3057
 
2806
3058
 
2807
3059
 
@@ -2994,6 +3246,21 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
2994
3246
 
2995
3247
 
2996
3248
 
3249
+
3250
+
3251
+
3252
+
3253
+
3254
+
3255
+
3256
+
3257
+
3258
+
3259
+
3260
+
3261
+
3262
+
3263
+
2997
3264
 
2998
3265
 
2999
3266
 
@@ -3186,6 +3453,21 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
3186
3453
 
3187
3454
 
3188
3455
 
3456
+
3457
+
3458
+
3459
+
3460
+
3461
+
3462
+
3463
+
3464
+
3465
+
3466
+
3467
+
3468
+
3469
+
3470
+
3189
3471
 
3190
3472
 
3191
3473
 
@@ -3406,6 +3688,12 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
3406
3688
 
3407
3689
 
3408
3690
 
3691
+
3692
+
3693
+
3694
+
3695
+
3696
+
3409
3697
  * @example
3410
3698
  * // Pagination by position in tree order
3411
3699
  * const tree = new TreeMultiSet<number>(
@@ -3442,6 +3730,21 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
3442
3730
 
3443
3731
 
3444
3732
 
3733
+
3734
+
3735
+
3736
+
3737
+
3738
+
3739
+
3740
+
3741
+
3742
+
3743
+
3744
+
3745
+
3746
+
3747
+
3445
3748
 
3446
3749
 
3447
3750
 
@@ -3589,6 +3892,18 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
3589
3892
 
3590
3893
 
3591
3894
 
3895
+
3896
+
3897
+
3898
+
3899
+
3900
+
3901
+
3902
+
3903
+
3904
+
3905
+
3906
+
3592
3907
 
3593
3908
 
3594
3909
 
@@ -3778,6 +4093,21 @@ export declare class TreeMultiSet<K = any, R = K> implements Iterable<K> {
3778
4093
 
3779
4094
 
3780
4095
 
4096
+
4097
+
4098
+
4099
+
4100
+
4101
+
4102
+
4103
+
4104
+
4105
+
4106
+
4107
+
4108
+
4109
+
4110
+
3781
4111
 
3782
4112
 
3783
4113