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
@@ -816,6 +816,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
816
816
 
817
817
 
818
818
 
819
+
820
+
821
+
822
+
819
823
 
820
824
 
821
825
 
@@ -883,6 +887,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
883
887
 
884
888
 
885
889
 
890
+
891
+
892
+
893
+
886
894
 
887
895
 
888
896
 
@@ -956,6 +964,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
956
964
 
957
965
 
958
966
 
967
+
968
+
969
+
970
+
959
971
 
960
972
 
961
973
 
@@ -1010,6 +1022,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1010
1022
 
1011
1023
 
1012
1024
 
1025
+
1026
+
1027
+
1028
+
1013
1029
 
1014
1030
 
1015
1031
 
@@ -1125,6 +1141,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1125
1141
 
1126
1142
 
1127
1143
 
1144
+
1145
+
1146
+
1147
+
1128
1148
 
1129
1149
 
1130
1150
 
@@ -1184,6 +1204,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1184
1204
 
1185
1205
 
1186
1206
 
1207
+
1208
+
1209
+
1210
+
1187
1211
 
1188
1212
 
1189
1213
 
@@ -1232,6 +1256,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1232
1256
 
1233
1257
 
1234
1258
 
1259
+
1260
+
1261
+
1262
+
1235
1263
 
1236
1264
 
1237
1265
 
@@ -1286,6 +1314,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1286
1314
 
1287
1315
 
1288
1316
 
1317
+
1318
+
1319
+
1320
+
1289
1321
 
1290
1322
 
1291
1323
 
@@ -1345,6 +1377,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1345
1377
 
1346
1378
 
1347
1379
 
1380
+
1381
+
1382
+
1383
+
1348
1384
 
1349
1385
 
1350
1386
 
@@ -1412,6 +1448,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1412
1448
 
1413
1449
 
1414
1450
 
1451
+
1452
+
1453
+
1454
+
1415
1455
 
1416
1456
 
1417
1457
 
@@ -1456,6 +1496,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1456
1496
 
1457
1497
 
1458
1498
 
1499
+
1500
+
1501
+
1502
+
1459
1503
 
1460
1504
 
1461
1505
 
@@ -1506,6 +1550,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1506
1550
 
1507
1551
 
1508
1552
 
1553
+
1554
+
1555
+
1556
+
1509
1557
 
1510
1558
 
1511
1559
 
@@ -1722,6 +1770,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1722
1770
 
1723
1771
 
1724
1772
 
1773
+
1774
+
1775
+
1776
+
1725
1777
 
1726
1778
 
1727
1779
 
@@ -1776,6 +1828,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1776
1828
 
1777
1829
 
1778
1830
 
1831
+
1832
+
1833
+
1834
+
1779
1835
 
1780
1836
 
1781
1837
 
@@ -1858,6 +1914,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1858
1914
 
1859
1915
 
1860
1916
 
1917
+
1918
+
1919
+
1920
+
1861
1921
 
1862
1922
 
1863
1923
 
@@ -2178,6 +2238,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2178
2238
 
2179
2239
 
2180
2240
 
2241
+
2242
+
2243
+
2244
+
2181
2245
 
2182
2246
 
2183
2247
 
@@ -2247,6 +2311,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2247
2311
 
2248
2312
 
2249
2313
 
2314
+
2315
+
2316
+
2317
+
2250
2318
 
2251
2319
 
2252
2320
 
@@ -2315,6 +2383,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2315
2383
 
2316
2384
 
2317
2385
 
2386
+
2387
+
2388
+
2389
+
2318
2390
 
2319
2391
 
2320
2392
 
@@ -2374,6 +2446,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2374
2446
 
2375
2447
 
2376
2448
 
2449
+
2450
+
2451
+
2452
+
2377
2453
 
2378
2454
 
2379
2455
 
@@ -2462,6 +2538,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2462
2538
 
2463
2539
 
2464
2540
 
2541
+
2542
+
2543
+
2544
+
2465
2545
 
2466
2546
 
2467
2547
 
@@ -2511,6 +2591,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2511
2591
 
2512
2592
 
2513
2593
 
2594
+
2595
+
2596
+
2597
+
2514
2598
 
2515
2599
 
2516
2600
 
@@ -2591,6 +2675,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2591
2675
 
2592
2676
 
2593
2677
 
2678
+
2679
+
2680
+
2681
+
2594
2682
 
2595
2683
 
2596
2684
 
@@ -2699,6 +2787,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2699
2787
 
2700
2788
 
2701
2789
 
2790
+
2791
+
2792
+
2793
+
2702
2794
 
2703
2795
 
2704
2796
 
@@ -2754,6 +2846,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2754
2846
 
2755
2847
 
2756
2848
 
2849
+
2850
+
2851
+
2852
+
2757
2853
 
2758
2854
 
2759
2855
 
@@ -2811,6 +2907,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2811
2907
 
2812
2908
 
2813
2909
 
2910
+
2911
+
2912
+
2913
+
2814
2914
 
2815
2915
 
2816
2916
 
@@ -2855,6 +2955,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2855
2955
 
2856
2956
 
2857
2957
 
2958
+
2959
+
2960
+
2961
+
2858
2962
 
2859
2963
 
2860
2964
 
@@ -2903,6 +3007,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2903
3007
 
2904
3008
 
2905
3009
 
3010
+
3011
+
3012
+
3013
+
2906
3014
 
2907
3015
 
2908
3016
 
@@ -2955,6 +3063,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2955
3063
 
2956
3064
 
2957
3065
 
3066
+
3067
+
3068
+
3069
+
2958
3070
 
2959
3071
 
2960
3072
 
@@ -3010,6 +3122,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
3010
3122
 
3011
3123
 
3012
3124
 
3125
+
3126
+
3127
+
3128
+
3013
3129
 
3014
3130
 
3015
3131
 
@@ -3031,6 +3147,25 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
3031
3147
  }
3032
3148
  return this;
3033
3149
  }
3150
+ /**
3151
+ * Delete the first element that satisfies a predicate.
3152
+ * @remarks Time O(N), Space O(1)
3153
+ * @param predicate - Function (value, index, list) → boolean to decide deletion.
3154
+ * @returns True if a match was removed.
3155
+ */
3156
+ deleteWhere(predicate) {
3157
+ let current = this.head;
3158
+ let index = 0;
3159
+ while (current) {
3160
+ if (predicate(current.value, index, this)) {
3161
+ this.delete(current);
3162
+ return true;
3163
+ }
3164
+ current = current.next;
3165
+ index++;
3166
+ }
3167
+ return false;
3168
+ }
3034
3169
  /**
3035
3170
  * Set the equality comparator used to compare values.
3036
3171
  * @remarks Time O(1), Space O(1)
@@ -3073,6 +3208,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
3073
3208
 
3074
3209
 
3075
3210
 
3211
+
3212
+
3213
+
3214
+
3076
3215
 
3077
3216
 
3078
3217
 
@@ -3126,6 +3265,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
3126
3265
 
3127
3266
 
3128
3267
 
3268
+
3269
+
3270
+
3271
+
3129
3272
 
3130
3273
 
3131
3274
 
@@ -3198,6 +3341,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
3198
3341
 
3199
3342
 
3200
3343
 
3344
+
3345
+
3346
+
3347
+
3201
3348
 
3202
3349
 
3203
3350
 
@@ -3599,6 +3746,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3599
3746
 
3600
3747
 
3601
3748
 
3749
+
3750
+
3751
+
3752
+
3602
3753
 
3603
3754
 
3604
3755
 
@@ -3641,6 +3792,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3641
3792
 
3642
3793
 
3643
3794
 
3795
+
3796
+
3797
+
3798
+
3644
3799
 
3645
3800
 
3646
3801
 
@@ -3686,6 +3841,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3686
3841
 
3687
3842
 
3688
3843
 
3844
+
3845
+
3846
+
3847
+
3689
3848
 
3690
3849
 
3691
3850
 
@@ -3739,6 +3898,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3739
3898
 
3740
3899
 
3741
3900
 
3901
+
3902
+
3903
+
3904
+
3742
3905
 
3743
3906
 
3744
3907
 
@@ -3817,6 +3980,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3817
3980
 
3818
3981
 
3819
3982
 
3983
+
3984
+
3985
+
3986
+
3820
3987
 
3821
3988
 
3822
3989
 
@@ -3880,6 +4047,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3880
4047
 
3881
4048
 
3882
4049
 
4050
+
4051
+
4052
+
4053
+
3883
4054
 
3884
4055
 
3885
4056
 
@@ -3926,6 +4097,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3926
4097
 
3927
4098
 
3928
4099
 
4100
+
4101
+
4102
+
4103
+
3929
4104
 
3930
4105
 
3931
4106
 
@@ -3992,6 +4167,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3992
4167
 
3993
4168
 
3994
4169
 
4170
+
4171
+
4172
+
4173
+
3995
4174
 
3996
4175
 
3997
4176
 
@@ -4038,6 +4217,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
4038
4217
 
4039
4218
 
4040
4219
 
4220
+
4221
+
4222
+
4223
+
4041
4224
 
4042
4225
 
4043
4226
 
@@ -4086,6 +4269,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
4086
4269
 
4087
4270
 
4088
4271
 
4272
+
4273
+
4274
+
4275
+
4089
4276
 
4090
4277
 
4091
4278
 
@@ -4132,6 +4319,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
4132
4319
 
4133
4320
 
4134
4321
 
4322
+
4323
+
4324
+
4325
+
4135
4326
 
4136
4327
 
4137
4328
 
@@ -4181,6 +4372,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
4181
4372
 
4182
4373
 
4183
4374
 
4375
+
4376
+
4377
+
4378
+
4184
4379
 
4185
4380
 
4186
4381
 
@@ -4235,6 +4430,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
4235
4430
 
4236
4431
 
4237
4432
 
4433
+
4434
+
4435
+
4436
+
4238
4437
 
4239
4438
 
4240
4439
 
@@ -4287,6 +4486,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
4287
4486
 
4288
4487
 
4289
4488
 
4489
+
4490
+
4491
+
4492
+
4290
4493
 
4291
4494
 
4292
4495
 
@@ -4338,6 +4541,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
4338
4541
 
4339
4542
 
4340
4543
 
4544
+
4545
+
4546
+
4547
+
4341
4548
 
4342
4549
 
4343
4550
 
@@ -4395,6 +4602,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
4395
4602
 
4396
4603
 
4397
4604
 
4605
+
4606
+
4607
+
4608
+
4398
4609
 
4399
4610
 
4400
4611
 
@@ -4460,6 +4671,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
4460
4671
 
4461
4672
 
4462
4673
 
4674
+
4675
+
4676
+
4677
+
4463
4678
 
4464
4679
 
4465
4680
 
@@ -4509,6 +4724,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
4509
4724
 
4510
4725
 
4511
4726
 
4727
+
4728
+
4729
+
4730
+
4512
4731
 
4513
4732
 
4514
4733