linked-list-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 +219 -0
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs-legacy/index.cjs +219 -0
  4. package/dist/cjs-legacy/index.cjs.map +1 -1
  5. package/dist/esm/index.mjs +219 -0
  6. package/dist/esm/index.mjs.map +1 -1
  7. package/dist/esm-legacy/index.mjs +219 -0
  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/linked-list-typed.js +219 -0
  33. package/dist/umd/linked-list-typed.js.map +1 -1
  34. package/dist/umd/linked-list-typed.min.js +1 -1
  35. package/dist/umd/linked-list-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
@@ -812,6 +812,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
812
812
 
813
813
 
814
814
 
815
+
816
+
817
+
818
+
815
819
 
816
820
 
817
821
 
@@ -879,6 +883,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
879
883
 
880
884
 
881
885
 
886
+
887
+
888
+
889
+
882
890
 
883
891
 
884
892
 
@@ -951,6 +959,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
951
959
 
952
960
 
953
961
 
962
+
963
+
964
+
965
+
954
966
 
955
967
 
956
968
 
@@ -1005,6 +1017,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1005
1017
 
1006
1018
 
1007
1019
 
1020
+
1021
+
1022
+
1023
+
1008
1024
 
1009
1025
 
1010
1026
 
@@ -1120,6 +1136,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1120
1136
 
1121
1137
 
1122
1138
 
1139
+
1140
+
1141
+
1142
+
1123
1143
 
1124
1144
 
1125
1145
 
@@ -1179,6 +1199,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1179
1199
 
1180
1200
 
1181
1201
 
1202
+
1203
+
1204
+
1205
+
1182
1206
 
1183
1207
 
1184
1208
 
@@ -1227,6 +1251,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1227
1251
 
1228
1252
 
1229
1253
 
1254
+
1255
+
1256
+
1257
+
1230
1258
 
1231
1259
 
1232
1260
 
@@ -1281,6 +1309,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1281
1309
 
1282
1310
 
1283
1311
 
1312
+
1313
+
1314
+
1315
+
1284
1316
 
1285
1317
 
1286
1318
 
@@ -1340,6 +1372,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1340
1372
 
1341
1373
 
1342
1374
 
1375
+
1376
+
1377
+
1378
+
1343
1379
 
1344
1380
 
1345
1381
 
@@ -1407,6 +1443,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1407
1443
 
1408
1444
 
1409
1445
 
1446
+
1447
+
1448
+
1449
+
1410
1450
 
1411
1451
 
1412
1452
 
@@ -1451,6 +1491,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1451
1491
 
1452
1492
 
1453
1493
 
1494
+
1495
+
1496
+
1497
+
1454
1498
 
1455
1499
 
1456
1500
 
@@ -1501,6 +1545,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1501
1545
 
1502
1546
 
1503
1547
 
1548
+
1549
+
1550
+
1551
+
1504
1552
 
1505
1553
 
1506
1554
 
@@ -1717,6 +1765,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1717
1765
 
1718
1766
 
1719
1767
 
1768
+
1769
+
1770
+
1771
+
1720
1772
 
1721
1773
 
1722
1774
 
@@ -1771,6 +1823,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1771
1823
 
1772
1824
 
1773
1825
 
1826
+
1827
+
1828
+
1829
+
1774
1830
 
1775
1831
 
1776
1832
 
@@ -1853,6 +1909,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1853
1909
 
1854
1910
 
1855
1911
 
1912
+
1913
+
1914
+
1915
+
1856
1916
 
1857
1917
 
1858
1918
 
@@ -2173,6 +2233,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2173
2233
 
2174
2234
 
2175
2235
 
2236
+
2237
+
2238
+
2239
+
2176
2240
 
2177
2241
 
2178
2242
 
@@ -2242,6 +2306,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2242
2306
 
2243
2307
 
2244
2308
 
2309
+
2310
+
2311
+
2312
+
2245
2313
 
2246
2314
 
2247
2315
 
@@ -2310,6 +2378,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2310
2378
 
2311
2379
 
2312
2380
 
2381
+
2382
+
2383
+
2384
+
2313
2385
 
2314
2386
 
2315
2387
 
@@ -2369,6 +2441,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2369
2441
 
2370
2442
 
2371
2443
 
2444
+
2445
+
2446
+
2447
+
2372
2448
 
2373
2449
 
2374
2450
 
@@ -2457,6 +2533,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2457
2533
 
2458
2534
 
2459
2535
 
2536
+
2537
+
2538
+
2539
+
2460
2540
 
2461
2541
 
2462
2542
 
@@ -2506,6 +2586,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2506
2586
 
2507
2587
 
2508
2588
 
2589
+
2590
+
2591
+
2592
+
2509
2593
 
2510
2594
 
2511
2595
 
@@ -2586,6 +2670,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2586
2670
 
2587
2671
 
2588
2672
 
2673
+
2674
+
2675
+
2676
+
2589
2677
 
2590
2678
 
2591
2679
 
@@ -2694,6 +2782,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2694
2782
 
2695
2783
 
2696
2784
 
2785
+
2786
+
2787
+
2788
+
2697
2789
 
2698
2790
 
2699
2791
 
@@ -2749,6 +2841,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2749
2841
 
2750
2842
 
2751
2843
 
2844
+
2845
+
2846
+
2847
+
2752
2848
 
2753
2849
 
2754
2850
 
@@ -2806,6 +2902,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2806
2902
 
2807
2903
 
2808
2904
 
2905
+
2906
+
2907
+
2908
+
2809
2909
 
2810
2910
 
2811
2911
 
@@ -2850,6 +2950,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2850
2950
 
2851
2951
 
2852
2952
 
2953
+
2954
+
2955
+
2956
+
2853
2957
 
2854
2958
 
2855
2959
 
@@ -2898,6 +3002,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2898
3002
 
2899
3003
 
2900
3004
 
3005
+
3006
+
3007
+
3008
+
2901
3009
 
2902
3010
 
2903
3011
 
@@ -2950,6 +3058,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2950
3058
 
2951
3059
 
2952
3060
 
3061
+
3062
+
3063
+
3064
+
2953
3065
 
2954
3066
 
2955
3067
 
@@ -3005,6 +3117,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
3005
3117
 
3006
3118
 
3007
3119
 
3120
+
3121
+
3122
+
3123
+
3008
3124
 
3009
3125
 
3010
3126
 
@@ -3026,6 +3142,25 @@ var DoublyLinkedList = class extends LinearLinkedBase {
3026
3142
  }
3027
3143
  return this;
3028
3144
  }
3145
+ /**
3146
+ * Delete the first element that satisfies a predicate.
3147
+ * @remarks Time O(N), Space O(1)
3148
+ * @param predicate - Function (value, index, list) → boolean to decide deletion.
3149
+ * @returns True if a match was removed.
3150
+ */
3151
+ deleteWhere(predicate) {
3152
+ let current = this.head;
3153
+ let index = 0;
3154
+ while (current) {
3155
+ if (predicate(current.value, index, this)) {
3156
+ this.delete(current);
3157
+ return true;
3158
+ }
3159
+ current = current.next;
3160
+ index++;
3161
+ }
3162
+ return false;
3163
+ }
3029
3164
  /**
3030
3165
  * Set the equality comparator used to compare values.
3031
3166
  * @remarks Time O(1), Space O(1)
@@ -3068,6 +3203,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
3068
3203
 
3069
3204
 
3070
3205
 
3206
+
3207
+
3208
+
3209
+
3071
3210
 
3072
3211
 
3073
3212
 
@@ -3121,6 +3260,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
3121
3260
 
3122
3261
 
3123
3262
 
3263
+
3264
+
3265
+
3266
+
3124
3267
 
3125
3268
 
3126
3269
 
@@ -3193,6 +3336,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
3193
3336
 
3194
3337
 
3195
3338
 
3339
+
3340
+
3341
+
3342
+
3196
3343
 
3197
3344
 
3198
3345
 
@@ -3596,6 +3743,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
3596
3743
 
3597
3744
 
3598
3745
 
3746
+
3747
+
3748
+
3749
+
3599
3750
 
3600
3751
 
3601
3752
 
@@ -3638,6 +3789,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
3638
3789
 
3639
3790
 
3640
3791
 
3792
+
3793
+
3794
+
3795
+
3641
3796
 
3642
3797
 
3643
3798
 
@@ -3683,6 +3838,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
3683
3838
 
3684
3839
 
3685
3840
 
3841
+
3842
+
3843
+
3844
+
3686
3845
 
3687
3846
 
3688
3847
 
@@ -3736,6 +3895,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
3736
3895
 
3737
3896
 
3738
3897
 
3898
+
3899
+
3900
+
3901
+
3739
3902
 
3740
3903
 
3741
3904
 
@@ -3814,6 +3977,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
3814
3977
 
3815
3978
 
3816
3979
 
3980
+
3981
+
3982
+
3983
+
3817
3984
 
3818
3985
 
3819
3986
 
@@ -3877,6 +4044,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
3877
4044
 
3878
4045
 
3879
4046
 
4047
+
4048
+
4049
+
4050
+
3880
4051
 
3881
4052
 
3882
4053
 
@@ -3923,6 +4094,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
3923
4094
 
3924
4095
 
3925
4096
 
4097
+
4098
+
4099
+
4100
+
3926
4101
 
3927
4102
 
3928
4103
 
@@ -3989,6 +4164,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
3989
4164
 
3990
4165
 
3991
4166
 
4167
+
4168
+
4169
+
4170
+
3992
4171
 
3993
4172
 
3994
4173
 
@@ -4035,6 +4214,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
4035
4214
 
4036
4215
 
4037
4216
 
4217
+
4218
+
4219
+
4220
+
4038
4221
 
4039
4222
 
4040
4223
 
@@ -4083,6 +4266,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
4083
4266
 
4084
4267
 
4085
4268
 
4269
+
4270
+
4271
+
4272
+
4086
4273
 
4087
4274
 
4088
4275
 
@@ -4129,6 +4316,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
4129
4316
 
4130
4317
 
4131
4318
 
4319
+
4320
+
4321
+
4322
+
4132
4323
 
4133
4324
 
4134
4325
 
@@ -4178,6 +4369,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
4178
4369
 
4179
4370
 
4180
4371
 
4372
+
4373
+
4374
+
4375
+
4181
4376
 
4182
4377
 
4183
4378
 
@@ -4232,6 +4427,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
4232
4427
 
4233
4428
 
4234
4429
 
4430
+
4431
+
4432
+
4433
+
4235
4434
 
4236
4435
 
4237
4436
 
@@ -4284,6 +4483,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
4284
4483
 
4285
4484
 
4286
4485
 
4486
+
4487
+
4488
+
4489
+
4287
4490
 
4288
4491
 
4289
4492
 
@@ -4335,6 +4538,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
4335
4538
 
4336
4539
 
4337
4540
 
4541
+
4542
+
4543
+
4544
+
4338
4545
 
4339
4546
 
4340
4547
 
@@ -4392,6 +4599,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
4392
4599
 
4393
4600
 
4394
4601
 
4602
+
4603
+
4604
+
4605
+
4395
4606
 
4396
4607
 
4397
4608
 
@@ -4457,6 +4668,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
4457
4668
 
4458
4669
 
4459
4670
 
4671
+
4672
+
4673
+
4674
+
4460
4675
 
4461
4676
 
4462
4677
 
@@ -4506,6 +4721,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
4506
4721
 
4507
4722
 
4508
4723
 
4724
+
4725
+
4726
+
4727
+
4509
4728
 
4510
4729
 
4511
4730