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
@@ -275,6 +275,21 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
275
275
 
276
276
 
277
277
 
278
+
279
+
280
+
281
+
282
+
283
+
284
+
285
+
286
+
287
+
288
+
289
+
290
+
291
+
292
+
278
293
 
279
294
 
280
295
 
@@ -464,6 +479,21 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
464
479
 
465
480
 
466
481
 
482
+
483
+
484
+
485
+
486
+
487
+
488
+
489
+
490
+
491
+
492
+
493
+
494
+
495
+
496
+
467
497
 
468
498
 
469
499
 
@@ -520,6 +550,9 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
520
550
 
521
551
 
522
552
 
553
+
554
+
555
+
523
556
 
524
557
 
525
558
 
@@ -565,6 +598,9 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
565
598
 
566
599
 
567
600
 
601
+
602
+
603
+
568
604
 
569
605
 
570
606
 
@@ -787,6 +823,24 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
787
823
 
788
824
 
789
825
 
826
+
827
+
828
+
829
+
830
+
831
+
832
+
833
+
834
+
835
+
836
+
837
+
838
+
839
+
840
+
841
+
842
+
843
+
790
844
 
791
845
 
792
846
 
@@ -1022,6 +1076,24 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
1022
1076
 
1023
1077
 
1024
1078
 
1079
+
1080
+
1081
+
1082
+
1083
+
1084
+
1085
+
1086
+
1087
+
1088
+
1089
+
1090
+
1091
+
1092
+
1093
+
1094
+
1095
+
1096
+
1025
1097
 
1026
1098
 
1027
1099
 
@@ -1212,6 +1284,21 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
1212
1284
 
1213
1285
 
1214
1286
 
1287
+
1288
+
1289
+
1290
+
1291
+
1292
+
1293
+
1294
+
1295
+
1296
+
1297
+
1298
+
1299
+
1300
+
1301
+
1215
1302
 
1216
1303
 
1217
1304
 
@@ -1448,6 +1535,24 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
1448
1535
 
1449
1536
 
1450
1537
 
1538
+
1539
+
1540
+
1541
+
1542
+
1543
+
1544
+
1545
+
1546
+
1547
+
1548
+
1549
+
1550
+
1551
+
1552
+
1553
+
1554
+
1555
+
1451
1556
 
1452
1557
 
1453
1558
 
@@ -1703,6 +1808,24 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
1703
1808
 
1704
1809
 
1705
1810
 
1811
+
1812
+
1813
+
1814
+
1815
+
1816
+
1817
+
1818
+
1819
+
1820
+
1821
+
1822
+
1823
+
1824
+
1825
+
1826
+
1827
+
1828
+
1706
1829
 
1707
1830
 
1708
1831
 
@@ -1764,6 +1887,9 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
1764
1887
 
1765
1888
 
1766
1889
 
1890
+
1891
+
1892
+
1767
1893
 
1768
1894
 
1769
1895
 
@@ -1810,6 +1936,9 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
1810
1936
 
1811
1937
 
1812
1938
 
1939
+
1940
+
1941
+
1813
1942
 
1814
1943
 
1815
1944
 
@@ -1861,6 +1990,9 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
1861
1990
 
1862
1991
 
1863
1992
 
1993
+
1994
+
1995
+
1864
1996
 
1865
1997
 
1866
1998
 
@@ -2066,6 +2198,21 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
2066
2198
 
2067
2199
 
2068
2200
 
2201
+
2202
+
2203
+
2204
+
2205
+
2206
+
2207
+
2208
+
2209
+
2210
+
2211
+
2212
+
2213
+
2214
+
2215
+
2069
2216
 
2070
2217
 
2071
2218
 
@@ -2258,6 +2405,21 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
2258
2405
 
2259
2406
 
2260
2407
 
2408
+
2409
+
2410
+
2411
+
2412
+
2413
+
2414
+
2415
+
2416
+
2417
+
2418
+
2419
+
2420
+
2421
+
2422
+
2261
2423
 
2262
2424
 
2263
2425
 
@@ -2285,6 +2447,32 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
2285
2447
  for (const [, bucket] of this) yield bucket;
2286
2448
  }
2287
2449
 
2450
+ /**
2451
+ * Iterate over all `[key, values[]]` entries (Map-compatible).
2452
+ * @remarks Time O(n), Space O(1) per step.
2453
+
2454
+
2455
+
2456
+
2457
+
2458
+
2459
+
2460
+
2461
+ * @example
2462
+ * // Iterate over entries
2463
+ * const mm = new TreeMultiMap<number, string>();
2464
+ * mm.set(1, 'a');
2465
+ * mm.set(1, 'b');
2466
+ * mm.set(2, 'c');
2467
+ * console.log([...mm.entries()]); // [
2468
+ * // [1, ['a', 'b']],
2469
+ * // [2, ['c']]
2470
+ * // ];
2471
+ */
2472
+ *entries(): IterableIterator<[K, V[]]> {
2473
+ yield* this;
2474
+ }
2475
+
2288
2476
  // ---- entry-flat views ----
2289
2477
 
2290
2478
  /**
@@ -2316,6 +2504,9 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
2316
2504
 
2317
2505
 
2318
2506
 
2507
+
2508
+
2509
+
2319
2510
 
2320
2511
 
2321
2512
 
@@ -2362,6 +2553,9 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
2362
2553
 
2363
2554
 
2364
2555
 
2556
+
2557
+
2558
+
2365
2559
 
2366
2560
 
2367
2561
 
@@ -2408,6 +2602,9 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
2408
2602
 
2409
2603
 
2410
2604
 
2605
+
2606
+
2607
+
2411
2608
 
2412
2609
 
2413
2610
 
@@ -2494,6 +2691,12 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
2494
2691
 
2495
2692
 
2496
2693
 
2694
+
2695
+
2696
+
2697
+
2698
+
2699
+
2497
2700
 
2498
2701
 
2499
2702
 
@@ -2581,6 +2784,12 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
2581
2784
 
2582
2785
 
2583
2786
 
2787
+
2788
+
2789
+
2790
+
2791
+
2792
+
2584
2793
 
2585
2794
 
2586
2795
 
@@ -2632,6 +2841,9 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
2632
2841
 
2633
2842
 
2634
2843
 
2844
+
2845
+
2846
+
2635
2847
 
2636
2848
 
2637
2849
 
@@ -2682,6 +2894,9 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
2682
2894
 
2683
2895
 
2684
2896
 
2897
+
2898
+
2899
+
2685
2900
 
2686
2901
 
2687
2902
 
@@ -2869,6 +3084,21 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
2869
3084
 
2870
3085
 
2871
3086
 
3087
+
3088
+
3089
+
3090
+
3091
+
3092
+
3093
+
3094
+
3095
+
3096
+
3097
+
3098
+
3099
+
3100
+
3101
+
2872
3102
 
2873
3103
 
2874
3104
 
@@ -3069,6 +3299,21 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
3069
3299
 
3070
3300
 
3071
3301
 
3302
+
3303
+
3304
+
3305
+
3306
+
3307
+
3308
+
3309
+
3310
+
3311
+
3312
+
3313
+
3314
+
3315
+
3316
+
3072
3317
 
3073
3318
 
3074
3319
 
@@ -3233,6 +3478,18 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
3233
3478
 
3234
3479
 
3235
3480
 
3481
+
3482
+
3483
+
3484
+
3485
+
3486
+
3487
+
3488
+
3489
+
3490
+
3491
+
3492
+
3236
3493
 
3237
3494
 
3238
3495
 
@@ -3393,6 +3650,18 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
3393
3650
 
3394
3651
 
3395
3652
 
3653
+
3654
+
3655
+
3656
+
3657
+
3658
+
3659
+
3660
+
3661
+
3662
+
3663
+
3664
+
3396
3665
 
3397
3666
 
3398
3667
 
@@ -3588,6 +3857,21 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
3588
3857
 
3589
3858
 
3590
3859
 
3860
+
3861
+
3862
+
3863
+
3864
+
3865
+
3866
+
3867
+
3868
+
3869
+
3870
+
3871
+
3872
+
3873
+
3874
+
3591
3875
 
3592
3876
 
3593
3877
 
@@ -3779,6 +4063,21 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
3779
4063
 
3780
4064
 
3781
4065
 
4066
+
4067
+
4068
+
4069
+
4070
+
4071
+
4072
+
4073
+
4074
+
4075
+
4076
+
4077
+
4078
+
4079
+
4080
+
3782
4081
 
3783
4082
 
3784
4083
 
@@ -3975,6 +4274,21 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
3975
4274
 
3976
4275
 
3977
4276
 
4277
+
4278
+
4279
+
4280
+
4281
+
4282
+
4283
+
4284
+
4285
+
4286
+
4287
+
4288
+
4289
+
4290
+
4291
+
3978
4292
 
3979
4293
 
3980
4294
 
@@ -4173,6 +4487,21 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
4173
4487
 
4174
4488
 
4175
4489
 
4490
+
4491
+
4492
+
4493
+
4494
+
4495
+
4496
+
4497
+
4498
+
4499
+
4500
+
4501
+
4502
+
4503
+
4504
+
4176
4505
 
4177
4506
 
4178
4507
 
@@ -4371,6 +4700,21 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
4371
4700
 
4372
4701
 
4373
4702
 
4703
+
4704
+
4705
+
4706
+
4707
+
4708
+
4709
+
4710
+
4711
+
4712
+
4713
+
4714
+
4715
+
4716
+
4717
+
4374
4718
 
4375
4719
 
4376
4720
 
@@ -4560,6 +4904,21 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
4560
4904
 
4561
4905
 
4562
4906
 
4907
+
4908
+
4909
+
4910
+
4911
+
4912
+
4913
+
4914
+
4915
+
4916
+
4917
+
4918
+
4919
+
4920
+
4921
+
4563
4922
 
4564
4923
 
4565
4924
 
@@ -4723,6 +5082,18 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
4723
5082
 
4724
5083
 
4725
5084
 
5085
+
5086
+
5087
+
5088
+
5089
+
5090
+
5091
+
5092
+
5093
+
5094
+
5095
+
5096
+
4726
5097
 
4727
5098
 
4728
5099
 
@@ -4954,6 +5325,12 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
4954
5325
 
4955
5326
 
4956
5327
 
5328
+
5329
+
5330
+
5331
+
5332
+
5333
+
4957
5334
  * @example
4958
5335
  * // Pagination by position in tree order
4959
5336
  * const tree = new TreeMultiMap<number>(
@@ -4996,6 +5373,21 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
4996
5373
 
4997
5374
 
4998
5375
 
5376
+
5377
+
5378
+
5379
+
5380
+
5381
+
5382
+
5383
+
5384
+
5385
+
5386
+
5387
+
5388
+
5389
+
5390
+
4999
5391
 
5000
5392
 
5001
5393