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.
Files changed (59) hide show
  1. package/dist/cjs/index.cjs +194 -55
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs-legacy/index.cjs +194 -55
  4. package/dist/cjs-legacy/index.cjs.map +1 -1
  5. package/dist/esm/index.mjs +194 -55
  6. package/dist/esm/index.mjs.map +1 -1
  7. package/dist/esm-legacy/index.mjs +194 -55
  8. package/dist/esm-legacy/index.mjs.map +1 -1
  9. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +50 -2
  10. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +56 -0
  11. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +116 -15
  12. package/dist/types/data-structures/binary-tree/bst.d.ts +99 -3
  13. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +79 -8
  14. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +24 -0
  15. package/dist/types/data-structures/binary-tree/tree-map.d.ts +520 -1
  16. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +489 -1
  17. package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +393 -1
  18. package/dist/types/data-structures/binary-tree/tree-set.d.ts +500 -1
  19. package/dist/types/data-structures/graph/directed-graph.d.ts +40 -0
  20. package/dist/types/data-structures/graph/undirected-graph.d.ts +36 -0
  21. package/dist/types/data-structures/hash/hash-map.d.ts +51 -6
  22. package/dist/types/data-structures/heap/heap.d.ts +98 -12
  23. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +75 -0
  24. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +61 -1
  25. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +72 -0
  26. package/dist/types/data-structures/matrix/matrix.d.ts +32 -0
  27. package/dist/types/data-structures/queue/deque.d.ts +82 -0
  28. package/dist/types/data-structures/queue/queue.d.ts +61 -0
  29. package/dist/types/data-structures/stack/stack.d.ts +42 -2
  30. package/dist/types/data-structures/trie/trie.d.ts +48 -0
  31. package/dist/types/interfaces/binary-tree.d.ts +2 -3
  32. package/dist/umd/binary-tree-typed.js +194 -55
  33. package/dist/umd/binary-tree-typed.js.map +1 -1
  34. package/dist/umd/binary-tree-typed.min.js +5 -5
  35. package/dist/umd/binary-tree-typed.min.js.map +1 -1
  36. package/package.json +2 -2
  37. package/src/data-structures/binary-tree/avl-tree.ts +52 -5
  38. package/src/data-structures/binary-tree/binary-indexed-tree.ts +56 -0
  39. package/src/data-structures/binary-tree/binary-tree.ts +167 -81
  40. package/src/data-structures/binary-tree/bst.ts +101 -7
  41. package/src/data-structures/binary-tree/red-black-tree.ts +82 -15
  42. package/src/data-structures/binary-tree/segment-tree.ts +24 -0
  43. package/src/data-structures/binary-tree/tree-map.ts +540 -3
  44. package/src/data-structures/binary-tree/tree-multi-map.ts +490 -2
  45. package/src/data-structures/binary-tree/tree-multi-set.ts +393 -1
  46. package/src/data-structures/binary-tree/tree-set.ts +520 -3
  47. package/src/data-structures/graph/directed-graph.ts +41 -1
  48. package/src/data-structures/graph/undirected-graph.ts +37 -1
  49. package/src/data-structures/hash/hash-map.ts +67 -12
  50. package/src/data-structures/heap/heap.ts +107 -19
  51. package/src/data-structures/linked-list/doubly-linked-list.ts +88 -0
  52. package/src/data-structures/linked-list/singly-linked-list.ts +61 -1
  53. package/src/data-structures/linked-list/skip-linked-list.ts +72 -0
  54. package/src/data-structures/matrix/matrix.ts +32 -0
  55. package/src/data-structures/queue/deque.ts +85 -0
  56. package/src/data-structures/queue/queue.ts +73 -0
  57. package/src/data-structures/stack/stack.ts +45 -5
  58. package/src/data-structures/trie/trie.ts +48 -0
  59. package/src/interfaces/binary-tree.ts +1 -9
@@ -250,6 +250,26 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
250
250
 
251
251
 
252
252
 
253
+
254
+
255
+
256
+
257
+
258
+
259
+
260
+
261
+
262
+
263
+
264
+
265
+
266
+
267
+
268
+
269
+
270
+
271
+
272
+
253
273
 
254
274
 
255
275
 
@@ -419,6 +439,26 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
419
439
 
420
440
 
421
441
 
442
+
443
+
444
+
445
+
446
+
447
+
448
+
449
+
450
+
451
+
452
+
453
+
454
+
455
+
456
+
457
+
458
+
459
+
460
+
461
+
422
462
 
423
463
 
424
464
 
@@ -475,6 +515,10 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
475
515
 
476
516
 
477
517
 
518
+
519
+
520
+
521
+
478
522
 
479
523
 
480
524
 
@@ -516,6 +560,10 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
516
560
 
517
561
 
518
562
 
563
+
564
+
565
+
566
+
519
567
 
520
568
 
521
569
 
@@ -713,6 +761,30 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
713
761
 
714
762
 
715
763
 
764
+
765
+
766
+
767
+
768
+
769
+
770
+
771
+
772
+
773
+
774
+
775
+
776
+
777
+
778
+
779
+
780
+
781
+
782
+
783
+
784
+
785
+
786
+
787
+
716
788
 
717
789
 
718
790
 
@@ -924,6 +996,30 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
924
996
 
925
997
 
926
998
 
999
+
1000
+
1001
+
1002
+
1003
+
1004
+
1005
+
1006
+
1007
+
1008
+
1009
+
1010
+
1011
+
1012
+
1013
+
1014
+
1015
+
1016
+
1017
+
1018
+
1019
+
1020
+
1021
+
1022
+
927
1023
 
928
1024
 
929
1025
 
@@ -1091,6 +1187,26 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
1091
1187
 
1092
1188
 
1093
1189
 
1190
+
1191
+
1192
+
1193
+
1194
+
1195
+
1196
+
1197
+
1198
+
1199
+
1200
+
1201
+
1202
+
1203
+
1204
+
1205
+
1206
+
1207
+
1208
+
1209
+
1094
1210
 
1095
1211
 
1096
1212
 
@@ -1306,6 +1422,30 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
1306
1422
 
1307
1423
 
1308
1424
 
1425
+
1426
+
1427
+
1428
+
1429
+
1430
+
1431
+
1432
+
1433
+
1434
+
1435
+
1436
+
1437
+
1438
+
1439
+
1440
+
1441
+
1442
+
1443
+
1444
+
1445
+
1446
+
1447
+
1448
+
1309
1449
 
1310
1450
 
1311
1451
 
@@ -1537,6 +1677,30 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
1537
1677
 
1538
1678
 
1539
1679
 
1680
+
1681
+
1682
+
1683
+
1684
+
1685
+
1686
+
1687
+
1688
+
1689
+
1690
+
1691
+
1692
+
1693
+
1694
+
1695
+
1696
+
1697
+
1698
+
1699
+
1700
+
1701
+
1702
+
1703
+
1540
1704
 
1541
1705
 
1542
1706
 
@@ -1568,7 +1732,7 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
1568
1732
  */
1569
1733
  delete(key: K): boolean {
1570
1734
  this._validateKey(key);
1571
- return this.#core.delete(key).length > 0;
1735
+ return this.#core.delete(key);
1572
1736
  }
1573
1737
 
1574
1738
  /**
@@ -1595,6 +1759,10 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
1595
1759
 
1596
1760
 
1597
1761
 
1762
+
1763
+
1764
+
1765
+
1598
1766
 
1599
1767
 
1600
1768
 
@@ -1637,6 +1805,10 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
1637
1805
 
1638
1806
 
1639
1807
 
1808
+
1809
+
1810
+
1811
+
1640
1812
 
1641
1813
 
1642
1814
 
@@ -1684,6 +1856,10 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
1684
1856
 
1685
1857
 
1686
1858
 
1859
+
1860
+
1861
+
1862
+
1687
1863
 
1688
1864
 
1689
1865
 
@@ -1865,6 +2041,26 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
1865
2041
 
1866
2042
 
1867
2043
 
2044
+
2045
+
2046
+
2047
+
2048
+
2049
+
2050
+
2051
+
2052
+
2053
+
2054
+
2055
+
2056
+
2057
+
2058
+
2059
+
2060
+
2061
+
2062
+
2063
+
1868
2064
 
1869
2065
 
1870
2066
 
@@ -2037,6 +2233,26 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
2037
2233
 
2038
2234
 
2039
2235
 
2236
+
2237
+
2238
+
2239
+
2240
+
2241
+
2242
+
2243
+
2244
+
2245
+
2246
+
2247
+
2248
+
2249
+
2250
+
2251
+
2252
+
2253
+
2254
+
2255
+
2040
2256
 
2041
2257
 
2042
2258
 
@@ -2095,6 +2311,10 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
2095
2311
 
2096
2312
 
2097
2313
 
2314
+
2315
+
2316
+
2317
+
2098
2318
 
2099
2319
 
2100
2320
 
@@ -2137,6 +2357,10 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
2137
2357
 
2138
2358
 
2139
2359
 
2360
+
2361
+
2362
+
2363
+
2140
2364
 
2141
2365
 
2142
2366
 
@@ -2179,6 +2403,10 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
2179
2403
 
2180
2404
 
2181
2405
 
2406
+
2407
+
2408
+
2409
+
2182
2410
 
2183
2411
 
2184
2412
 
@@ -2256,6 +2484,14 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
2256
2484
 
2257
2485
 
2258
2486
 
2487
+
2488
+
2489
+
2490
+
2491
+
2492
+
2493
+
2494
+
2259
2495
 
2260
2496
 
2261
2497
 
@@ -2335,6 +2571,14 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
2335
2571
 
2336
2572
 
2337
2573
 
2574
+
2575
+
2576
+
2577
+
2578
+
2579
+
2580
+
2581
+
2338
2582
 
2339
2583
 
2340
2584
 
@@ -2383,6 +2627,10 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
2383
2627
 
2384
2628
 
2385
2629
 
2630
+
2631
+
2632
+
2633
+
2386
2634
 
2387
2635
 
2388
2636
 
@@ -2429,6 +2677,10 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
2429
2677
 
2430
2678
 
2431
2679
 
2680
+
2681
+
2682
+
2683
+
2432
2684
 
2433
2685
 
2434
2686
 
@@ -2592,6 +2844,26 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
2592
2844
 
2593
2845
 
2594
2846
 
2847
+
2848
+
2849
+
2850
+
2851
+
2852
+
2853
+
2854
+
2855
+
2856
+
2857
+
2858
+
2859
+
2860
+
2861
+
2862
+
2863
+
2864
+
2865
+
2866
+
2595
2867
 
2596
2868
 
2597
2869
 
@@ -2772,6 +3044,26 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
2772
3044
 
2773
3045
 
2774
3046
 
3047
+
3048
+
3049
+
3050
+
3051
+
3052
+
3053
+
3054
+
3055
+
3056
+
3057
+
3058
+
3059
+
3060
+
3061
+
3062
+
3063
+
3064
+
3065
+
3066
+
2775
3067
 
2776
3068
 
2777
3069
 
@@ -2921,6 +3213,22 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
2921
3213
 
2922
3214
 
2923
3215
 
3216
+
3217
+
3218
+
3219
+
3220
+
3221
+
3222
+
3223
+
3224
+
3225
+
3226
+
3227
+
3228
+
3229
+
3230
+
3231
+
2924
3232
 
2925
3233
 
2926
3234
 
@@ -3065,6 +3373,22 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
3065
3373
 
3066
3374
 
3067
3375
 
3376
+
3377
+
3378
+
3379
+
3380
+
3381
+
3382
+
3383
+
3384
+
3385
+
3386
+
3387
+
3388
+
3389
+
3390
+
3391
+
3068
3392
 
3069
3393
 
3070
3394
 
@@ -3239,6 +3563,26 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
3239
3563
 
3240
3564
 
3241
3565
 
3566
+
3567
+
3568
+
3569
+
3570
+
3571
+
3572
+
3573
+
3574
+
3575
+
3576
+
3577
+
3578
+
3579
+
3580
+
3581
+
3582
+
3583
+
3584
+
3585
+
3242
3586
 
3243
3587
 
3244
3588
 
@@ -3410,6 +3754,26 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
3410
3754
 
3411
3755
 
3412
3756
 
3757
+
3758
+
3759
+
3760
+
3761
+
3762
+
3763
+
3764
+
3765
+
3766
+
3767
+
3768
+
3769
+
3770
+
3771
+
3772
+
3773
+
3774
+
3775
+
3776
+
3413
3777
 
3414
3778
 
3415
3779
 
@@ -3586,6 +3950,26 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
3586
3950
 
3587
3951
 
3588
3952
 
3953
+
3954
+
3955
+
3956
+
3957
+
3958
+
3959
+
3960
+
3961
+
3962
+
3963
+
3964
+
3965
+
3966
+
3967
+
3968
+
3969
+
3970
+
3971
+
3972
+
3589
3973
 
3590
3974
 
3591
3975
 
@@ -3764,6 +4148,26 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
3764
4148
 
3765
4149
 
3766
4150
 
4151
+
4152
+
4153
+
4154
+
4155
+
4156
+
4157
+
4158
+
4159
+
4160
+
4161
+
4162
+
4163
+
4164
+
4165
+
4166
+
4167
+
4168
+
4169
+
4170
+
3767
4171
 
3768
4172
 
3769
4173
 
@@ -3942,6 +4346,26 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
3942
4346
 
3943
4347
 
3944
4348
 
4349
+
4350
+
4351
+
4352
+
4353
+
4354
+
4355
+
4356
+
4357
+
4358
+
4359
+
4360
+
4361
+
4362
+
4363
+
4364
+
4365
+
4366
+
4367
+
4368
+
3945
4369
 
3946
4370
 
3947
4371
 
@@ -4111,6 +4535,26 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
4111
4535
 
4112
4536
 
4113
4537
 
4538
+
4539
+
4540
+
4541
+
4542
+
4543
+
4544
+
4545
+
4546
+
4547
+
4548
+
4549
+
4550
+
4551
+
4552
+
4553
+
4554
+
4555
+
4556
+
4557
+
4114
4558
 
4115
4559
 
4116
4560
 
@@ -4259,6 +4703,22 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
4259
4703
 
4260
4704
 
4261
4705
 
4706
+
4707
+
4708
+
4709
+
4710
+
4711
+
4712
+
4713
+
4714
+
4715
+
4716
+
4717
+
4718
+
4719
+
4720
+
4721
+
4262
4722
 
4263
4723
 
4264
4724
 
@@ -4486,8 +4946,16 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
4486
4946
  /**
4487
4947
  * Get elements by rank range
4488
4948
 
4949
+
4950
+
4951
+
4952
+
4953
+
4954
+
4955
+
4956
+
4489
4957
  * @example
4490
- * // Pagination with rangeByRank
4958
+ * // Pagination by position in tree order
4491
4959
  * const tree = new TreeMultiMap<number>(
4492
4960
  * [10, 20, 30, 40, 50, 60, 70, 80, 90],
4493
4961
  * { enableOrderStatistic: true }
@@ -4513,6 +4981,26 @@ export class TreeMultiMap<K = any, V = any, R = any> implements Iterable<[K, V[]
4513
4981
 
4514
4982
 
4515
4983
 
4984
+
4985
+
4986
+
4987
+
4988
+
4989
+
4990
+
4991
+
4992
+
4993
+
4994
+
4995
+
4996
+
4997
+
4998
+
4999
+
5000
+
5001
+
5002
+
5003
+
4516
5004
 
4517
5005
  * @example
4518
5006
  * // Deep clone