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
@@ -814,6 +814,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
814
814
 
815
815
 
816
816
 
817
+
818
+
819
+
820
+
817
821
 
818
822
 
819
823
 
@@ -881,6 +885,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
881
885
 
882
886
 
883
887
 
888
+
889
+
890
+
891
+
884
892
 
885
893
 
886
894
 
@@ -953,6 +961,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
953
961
 
954
962
 
955
963
 
964
+
965
+
966
+
967
+
956
968
 
957
969
 
958
970
 
@@ -1007,6 +1019,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1007
1019
 
1008
1020
 
1009
1021
 
1022
+
1023
+
1024
+
1025
+
1010
1026
 
1011
1027
 
1012
1028
 
@@ -1122,6 +1138,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1122
1138
 
1123
1139
 
1124
1140
 
1141
+
1142
+
1143
+
1144
+
1125
1145
 
1126
1146
 
1127
1147
 
@@ -1181,6 +1201,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1181
1201
 
1182
1202
 
1183
1203
 
1204
+
1205
+
1206
+
1207
+
1184
1208
 
1185
1209
 
1186
1210
 
@@ -1229,6 +1253,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1229
1253
 
1230
1254
 
1231
1255
 
1256
+
1257
+
1258
+
1259
+
1232
1260
 
1233
1261
 
1234
1262
 
@@ -1283,6 +1311,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1283
1311
 
1284
1312
 
1285
1313
 
1314
+
1315
+
1316
+
1317
+
1286
1318
 
1287
1319
 
1288
1320
 
@@ -1342,6 +1374,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1342
1374
 
1343
1375
 
1344
1376
 
1377
+
1378
+
1379
+
1380
+
1345
1381
 
1346
1382
 
1347
1383
 
@@ -1409,6 +1445,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1409
1445
 
1410
1446
 
1411
1447
 
1448
+
1449
+
1450
+
1451
+
1412
1452
 
1413
1453
 
1414
1454
 
@@ -1453,6 +1493,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1453
1493
 
1454
1494
 
1455
1495
 
1496
+
1497
+
1498
+
1499
+
1456
1500
 
1457
1501
 
1458
1502
 
@@ -1503,6 +1547,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1503
1547
 
1504
1548
 
1505
1549
 
1550
+
1551
+
1552
+
1553
+
1506
1554
 
1507
1555
 
1508
1556
 
@@ -1719,6 +1767,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1719
1767
 
1720
1768
 
1721
1769
 
1770
+
1771
+
1772
+
1773
+
1722
1774
 
1723
1775
 
1724
1776
 
@@ -1773,6 +1825,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1773
1825
 
1774
1826
 
1775
1827
 
1828
+
1829
+
1830
+
1831
+
1776
1832
 
1777
1833
 
1778
1834
 
@@ -1855,6 +1911,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1855
1911
 
1856
1912
 
1857
1913
 
1914
+
1915
+
1916
+
1917
+
1858
1918
 
1859
1919
 
1860
1920
 
@@ -2175,6 +2235,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2175
2235
 
2176
2236
 
2177
2237
 
2238
+
2239
+
2240
+
2241
+
2178
2242
 
2179
2243
 
2180
2244
 
@@ -2244,6 +2308,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2244
2308
 
2245
2309
 
2246
2310
 
2311
+
2312
+
2313
+
2314
+
2247
2315
 
2248
2316
 
2249
2317
 
@@ -2312,6 +2380,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2312
2380
 
2313
2381
 
2314
2382
 
2383
+
2384
+
2385
+
2386
+
2315
2387
 
2316
2388
 
2317
2389
 
@@ -2371,6 +2443,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2371
2443
 
2372
2444
 
2373
2445
 
2446
+
2447
+
2448
+
2449
+
2374
2450
 
2375
2451
 
2376
2452
 
@@ -2459,6 +2535,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2459
2535
 
2460
2536
 
2461
2537
 
2538
+
2539
+
2540
+
2541
+
2462
2542
 
2463
2543
 
2464
2544
 
@@ -2508,6 +2588,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2508
2588
 
2509
2589
 
2510
2590
 
2591
+
2592
+
2593
+
2594
+
2511
2595
 
2512
2596
 
2513
2597
 
@@ -2588,6 +2672,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2588
2672
 
2589
2673
 
2590
2674
 
2675
+
2676
+
2677
+
2678
+
2591
2679
 
2592
2680
 
2593
2681
 
@@ -2696,6 +2784,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2696
2784
 
2697
2785
 
2698
2786
 
2787
+
2788
+
2789
+
2790
+
2699
2791
 
2700
2792
 
2701
2793
 
@@ -2751,6 +2843,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2751
2843
 
2752
2844
 
2753
2845
 
2846
+
2847
+
2848
+
2849
+
2754
2850
 
2755
2851
 
2756
2852
 
@@ -2808,6 +2904,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2808
2904
 
2809
2905
 
2810
2906
 
2907
+
2908
+
2909
+
2910
+
2811
2911
 
2812
2912
 
2813
2913
 
@@ -2852,6 +2952,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2852
2952
 
2853
2953
 
2854
2954
 
2955
+
2956
+
2957
+
2958
+
2855
2959
 
2856
2960
 
2857
2961
 
@@ -2900,6 +3004,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2900
3004
 
2901
3005
 
2902
3006
 
3007
+
3008
+
3009
+
3010
+
2903
3011
 
2904
3012
 
2905
3013
 
@@ -2952,6 +3060,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2952
3060
 
2953
3061
 
2954
3062
 
3063
+
3064
+
3065
+
3066
+
2955
3067
 
2956
3068
 
2957
3069
 
@@ -3007,6 +3119,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
3007
3119
 
3008
3120
 
3009
3121
 
3122
+
3123
+
3124
+
3125
+
3010
3126
 
3011
3127
 
3012
3128
 
@@ -3028,6 +3144,25 @@ var DoublyLinkedList = class extends LinearLinkedBase {
3028
3144
  }
3029
3145
  return this;
3030
3146
  }
3147
+ /**
3148
+ * Delete the first element that satisfies a predicate.
3149
+ * @remarks Time O(N), Space O(1)
3150
+ * @param predicate - Function (value, index, list) → boolean to decide deletion.
3151
+ * @returns True if a match was removed.
3152
+ */
3153
+ deleteWhere(predicate) {
3154
+ let current = this.head;
3155
+ let index = 0;
3156
+ while (current) {
3157
+ if (predicate(current.value, index, this)) {
3158
+ this.delete(current);
3159
+ return true;
3160
+ }
3161
+ current = current.next;
3162
+ index++;
3163
+ }
3164
+ return false;
3165
+ }
3031
3166
  /**
3032
3167
  * Set the equality comparator used to compare values.
3033
3168
  * @remarks Time O(1), Space O(1)
@@ -3070,6 +3205,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
3070
3205
 
3071
3206
 
3072
3207
 
3208
+
3209
+
3210
+
3211
+
3073
3212
 
3074
3213
 
3075
3214
 
@@ -3123,6 +3262,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
3123
3262
 
3124
3263
 
3125
3264
 
3265
+
3266
+
3267
+
3268
+
3126
3269
 
3127
3270
 
3128
3271
 
@@ -3195,6 +3338,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
3195
3338
 
3196
3339
 
3197
3340
 
3341
+
3342
+
3343
+
3344
+
3198
3345
 
3199
3346
 
3200
3347
 
@@ -3598,6 +3745,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
3598
3745
 
3599
3746
 
3600
3747
 
3748
+
3749
+
3750
+
3751
+
3601
3752
 
3602
3753
 
3603
3754
 
@@ -3640,6 +3791,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
3640
3791
 
3641
3792
 
3642
3793
 
3794
+
3795
+
3796
+
3797
+
3643
3798
 
3644
3799
 
3645
3800
 
@@ -3685,6 +3840,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
3685
3840
 
3686
3841
 
3687
3842
 
3843
+
3844
+
3845
+
3846
+
3688
3847
 
3689
3848
 
3690
3849
 
@@ -3738,6 +3897,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
3738
3897
 
3739
3898
 
3740
3899
 
3900
+
3901
+
3902
+
3903
+
3741
3904
 
3742
3905
 
3743
3906
 
@@ -3816,6 +3979,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
3816
3979
 
3817
3980
 
3818
3981
 
3982
+
3983
+
3984
+
3985
+
3819
3986
 
3820
3987
 
3821
3988
 
@@ -3879,6 +4046,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
3879
4046
 
3880
4047
 
3881
4048
 
4049
+
4050
+
4051
+
4052
+
3882
4053
 
3883
4054
 
3884
4055
 
@@ -3925,6 +4096,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
3925
4096
 
3926
4097
 
3927
4098
 
4099
+
4100
+
4101
+
4102
+
3928
4103
 
3929
4104
 
3930
4105
 
@@ -3991,6 +4166,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
3991
4166
 
3992
4167
 
3993
4168
 
4169
+
4170
+
4171
+
4172
+
3994
4173
 
3995
4174
 
3996
4175
 
@@ -4037,6 +4216,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
4037
4216
 
4038
4217
 
4039
4218
 
4219
+
4220
+
4221
+
4222
+
4040
4223
 
4041
4224
 
4042
4225
 
@@ -4085,6 +4268,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
4085
4268
 
4086
4269
 
4087
4270
 
4271
+
4272
+
4273
+
4274
+
4088
4275
 
4089
4276
 
4090
4277
 
@@ -4131,6 +4318,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
4131
4318
 
4132
4319
 
4133
4320
 
4321
+
4322
+
4323
+
4324
+
4134
4325
 
4135
4326
 
4136
4327
 
@@ -4180,6 +4371,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
4180
4371
 
4181
4372
 
4182
4373
 
4374
+
4375
+
4376
+
4377
+
4183
4378
 
4184
4379
 
4185
4380
 
@@ -4234,6 +4429,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
4234
4429
 
4235
4430
 
4236
4431
 
4432
+
4433
+
4434
+
4435
+
4237
4436
 
4238
4437
 
4239
4438
 
@@ -4286,6 +4485,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
4286
4485
 
4287
4486
 
4288
4487
 
4488
+
4489
+
4490
+
4491
+
4289
4492
 
4290
4493
 
4291
4494
 
@@ -4337,6 +4540,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
4337
4540
 
4338
4541
 
4339
4542
 
4543
+
4544
+
4545
+
4546
+
4340
4547
 
4341
4548
 
4342
4549
 
@@ -4394,6 +4601,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
4394
4601
 
4395
4602
 
4396
4603
 
4604
+
4605
+
4606
+
4607
+
4397
4608
 
4398
4609
 
4399
4610
 
@@ -4459,6 +4670,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
4459
4670
 
4460
4671
 
4461
4672
 
4673
+
4674
+
4675
+
4676
+
4462
4677
 
4463
4678
 
4464
4679
 
@@ -4508,6 +4723,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
4508
4723
 
4509
4724
 
4510
4725
 
4726
+
4727
+
4728
+
4729
+
4511
4730
 
4512
4731
 
4513
4732