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