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
@@ -215,6 +215,10 @@ export declare class DoublyLinkedList<E = any, R = any> extends LinearLinkedBase
215
215
 
216
216
 
217
217
 
218
+
219
+
220
+
221
+
218
222
 
219
223
 
220
224
 
@@ -271,6 +275,10 @@ export declare class DoublyLinkedList<E = any, R = any> extends LinearLinkedBase
271
275
 
272
276
 
273
277
 
278
+
279
+
280
+
281
+
274
282
 
275
283
 
276
284
 
@@ -327,6 +335,10 @@ export declare class DoublyLinkedList<E = any, R = any> extends LinearLinkedBase
327
335
 
328
336
 
329
337
 
338
+
339
+
340
+
341
+
330
342
 
331
343
 
332
344
 
@@ -374,6 +386,10 @@ export declare class DoublyLinkedList<E = any, R = any> extends LinearLinkedBase
374
386
 
375
387
 
376
388
 
389
+
390
+
391
+
392
+
377
393
 
378
394
 
379
395
 
@@ -435,6 +451,10 @@ export declare class DoublyLinkedList<E = any, R = any> extends LinearLinkedBase
435
451
 
436
452
 
437
453
 
454
+
455
+
456
+
457
+
438
458
 
439
459
 
440
460
 
@@ -479,6 +499,10 @@ export declare class DoublyLinkedList<E = any, R = any> extends LinearLinkedBase
479
499
 
480
500
 
481
501
 
502
+
503
+
504
+
505
+
482
506
 
483
507
 
484
508
 
@@ -530,6 +554,10 @@ export declare class DoublyLinkedList<E = any, R = any> extends LinearLinkedBase
530
554
 
531
555
 
532
556
 
557
+
558
+
559
+
560
+
533
561
 
534
562
 
535
563
 
@@ -598,6 +626,10 @@ export declare class DoublyLinkedList<E = any, R = any> extends LinearLinkedBase
598
626
 
599
627
 
600
628
 
629
+
630
+
631
+
632
+
601
633
 
602
634
 
603
635
 
@@ -642,6 +674,10 @@ export declare class DoublyLinkedList<E = any, R = any> extends LinearLinkedBase
642
674
 
643
675
 
644
676
 
677
+
678
+
679
+
680
+
645
681
 
646
682
 
647
683
 
@@ -686,6 +722,10 @@ export declare class DoublyLinkedList<E = any, R = any> extends LinearLinkedBase
686
722
 
687
723
 
688
724
 
725
+
726
+
727
+
728
+
689
729
 
690
730
 
691
731
 
@@ -728,6 +768,10 @@ export declare class DoublyLinkedList<E = any, R = any> extends LinearLinkedBase
728
768
 
729
769
 
730
770
 
771
+
772
+
773
+
774
+
731
775
 
732
776
 
733
777
 
@@ -772,6 +816,10 @@ export declare class DoublyLinkedList<E = any, R = any> extends LinearLinkedBase
772
816
 
773
817
 
774
818
 
819
+
820
+
821
+
822
+
775
823
 
776
824
 
777
825
 
@@ -816,6 +864,10 @@ export declare class DoublyLinkedList<E = any, R = any> extends LinearLinkedBase
816
864
 
817
865
 
818
866
 
867
+
868
+
869
+
870
+
819
871
 
820
872
 
821
873
 
@@ -863,6 +915,10 @@ export declare class DoublyLinkedList<E = any, R = any> extends LinearLinkedBase
863
915
 
864
916
 
865
917
 
918
+
919
+
920
+
921
+
866
922
 
867
923
 
868
924
 
@@ -875,6 +931,13 @@ export declare class DoublyLinkedList<E = any, R = any> extends LinearLinkedBase
875
931
  * console.log([...list]); // [3, 2, 1];
876
932
  */
877
933
  reverse(): this;
934
+ /**
935
+ * Delete the first element that satisfies a predicate.
936
+ * @remarks Time O(N), Space O(1)
937
+ * @param predicate - Function (value, index, list) → boolean to decide deletion.
938
+ * @returns True if a match was removed.
939
+ */
940
+ deleteWhere(predicate: (value: E, index: number, list: this) => boolean): boolean;
878
941
  /**
879
942
  * Set the equality comparator used to compare values.
880
943
  * @remarks Time O(1), Space O(1)
@@ -914,6 +977,10 @@ export declare class DoublyLinkedList<E = any, R = any> extends LinearLinkedBase
914
977
 
915
978
 
916
979
 
980
+
981
+
982
+
983
+
917
984
 
918
985
 
919
986
 
@@ -963,6 +1030,10 @@ export declare class DoublyLinkedList<E = any, R = any> extends LinearLinkedBase
963
1030
 
964
1031
 
965
1032
 
1033
+
1034
+
1035
+
1036
+
966
1037
 
967
1038
 
968
1039
 
@@ -1022,6 +1093,10 @@ export declare class DoublyLinkedList<E = any, R = any> extends LinearLinkedBase
1022
1093
 
1023
1094
 
1024
1095
 
1096
+
1097
+
1098
+
1099
+
1025
1100
 
1026
1101
 
1027
1102
 
@@ -40,7 +40,7 @@ export declare class SinglyLinkedListNode<E = any> extends LinkedListNode<E> {
40
40
  * @remarks Time O(1), Space O(1)
41
41
  * @template E
42
42
  * @template R
43
- * 1. Node Structure: Each node contains three parts: a data field, a pointer (or reference) to the previous node, and a pointer to the next node. This structure allows traversal of the linked list in both directions.
43
+ * 1. Node Structure: Each node contains two parts: a data field and a pointer (or reference) to the next node. This structure allows forward-only traversal of the linked list.
44
44
  * 2. Bidirectional Traversal: Unlike doubly linked lists, singly linked lists can be easily traversed forwards but not backwards.
45
45
  * 3. No Centralized Index: Unlike arrays, elements in a linked list are not stored contiguously, so there is no centralized index. Accessing elements in a linked list typically requires traversing from the head or tail node.
46
46
  * 4. High Efficiency in Insertion and Deletion: Adding or removing elements in a linked list does not require moving other elements, making these operations more efficient than in arrays.
@@ -264,6 +264,10 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
264
264
 
265
265
 
266
266
 
267
+
268
+
269
+
270
+
267
271
 
268
272
 
269
273
 
@@ -320,6 +324,10 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
320
324
 
321
325
 
322
326
 
327
+
328
+
329
+
330
+
323
331
 
324
332
 
325
333
 
@@ -376,6 +384,10 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
376
384
 
377
385
 
378
386
 
387
+
388
+
389
+
390
+
379
391
 
380
392
 
381
393
 
@@ -423,6 +435,10 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
423
435
 
424
436
 
425
437
 
438
+
439
+
440
+
441
+
426
442
 
427
443
 
428
444
 
@@ -506,6 +522,10 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
506
522
 
507
523
 
508
524
 
525
+
526
+
527
+
528
+
509
529
 
510
530
 
511
531
 
@@ -558,6 +578,10 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
558
578
 
559
579
 
560
580
 
581
+
582
+
583
+
584
+
561
585
 
562
586
 
563
587
 
@@ -601,6 +625,10 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
601
625
 
602
626
 
603
627
 
628
+
629
+
630
+
631
+
604
632
 
605
633
 
606
634
 
@@ -645,6 +673,10 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
645
673
 
646
674
 
647
675
 
676
+
677
+
678
+
679
+
648
680
 
649
681
 
650
682
 
@@ -690,6 +722,10 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
690
722
 
691
723
 
692
724
 
725
+
726
+
727
+
728
+
693
729
 
694
730
 
695
731
 
@@ -742,6 +778,10 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
742
778
 
743
779
 
744
780
 
781
+
782
+
783
+
784
+
745
785
 
746
786
 
747
787
 
@@ -784,6 +824,10 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
784
824
 
785
825
 
786
826
 
827
+
828
+
829
+
830
+
787
831
 
788
832
 
789
833
 
@@ -830,6 +874,10 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
830
874
 
831
875
 
832
876
 
877
+
878
+
879
+
880
+
833
881
 
834
882
 
835
883
 
@@ -927,6 +975,10 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
927
975
 
928
976
 
929
977
 
978
+
979
+
980
+
981
+
930
982
 
931
983
 
932
984
 
@@ -977,6 +1029,10 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
977
1029
 
978
1030
 
979
1031
 
1032
+
1033
+
1034
+
1035
+
980
1036
 
981
1037
 
982
1038
 
@@ -1046,6 +1102,10 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
1046
1102
 
1047
1103
 
1048
1104
 
1105
+
1106
+
1107
+
1108
+
1049
1109
 
1050
1110
 
1051
1111
 
@@ -79,6 +79,10 @@ export declare class SkipList<K = any, V = any, R = [K, V]> extends IterableEntr
79
79
 
80
80
 
81
81
 
82
+
83
+
84
+
85
+
82
86
 
83
87
 
84
88
 
@@ -119,6 +123,10 @@ export declare class SkipList<K = any, V = any, R = [K, V]> extends IterableEntr
119
123
 
120
124
 
121
125
 
126
+
127
+
128
+
129
+
122
130
 
123
131
 
124
132
 
@@ -160,6 +168,10 @@ export declare class SkipList<K = any, V = any, R = [K, V]> extends IterableEntr
160
168
 
161
169
 
162
170
 
171
+
172
+
173
+
174
+
163
175
 
164
176
 
165
177
 
@@ -206,6 +218,10 @@ export declare class SkipList<K = any, V = any, R = [K, V]> extends IterableEntr
206
218
 
207
219
 
208
220
 
221
+
222
+
223
+
224
+
209
225
 
210
226
 
211
227
 
@@ -262,6 +278,10 @@ export declare class SkipList<K = any, V = any, R = [K, V]> extends IterableEntr
262
278
 
263
279
 
264
280
 
281
+
282
+
283
+
284
+
265
285
 
266
286
 
267
287
 
@@ -322,6 +342,10 @@ export declare class SkipList<K = any, V = any, R = [K, V]> extends IterableEntr
322
342
 
323
343
 
324
344
 
345
+
346
+
347
+
348
+
325
349
 
326
350
 
327
351
 
@@ -366,6 +390,10 @@ export declare class SkipList<K = any, V = any, R = [K, V]> extends IterableEntr
366
390
 
367
391
 
368
392
 
393
+
394
+
395
+
396
+
369
397
 
370
398
 
371
399
 
@@ -417,6 +445,10 @@ export declare class SkipList<K = any, V = any, R = [K, V]> extends IterableEntr
417
445
 
418
446
 
419
447
 
448
+
449
+
450
+
451
+
420
452
 
421
453
 
422
454
 
@@ -460,6 +492,10 @@ export declare class SkipList<K = any, V = any, R = [K, V]> extends IterableEntr
460
492
 
461
493
 
462
494
 
495
+
496
+
497
+
498
+
463
499
 
464
500
 
465
501
 
@@ -500,6 +536,10 @@ export declare class SkipList<K = any, V = any, R = [K, V]> extends IterableEntr
500
536
 
501
537
 
502
538
 
539
+
540
+
541
+
542
+
503
543
 
504
544
 
505
545
 
@@ -541,6 +581,10 @@ export declare class SkipList<K = any, V = any, R = [K, V]> extends IterableEntr
541
581
 
542
582
 
543
583
 
584
+
585
+
586
+
587
+
544
588
 
545
589
 
546
590
 
@@ -585,6 +629,10 @@ export declare class SkipList<K = any, V = any, R = [K, V]> extends IterableEntr
585
629
 
586
630
 
587
631
 
632
+
633
+
634
+
635
+
588
636
 
589
637
 
590
638
 
@@ -629,6 +677,10 @@ export declare class SkipList<K = any, V = any, R = [K, V]> extends IterableEntr
629
677
 
630
678
 
631
679
 
680
+
681
+
682
+
683
+
632
684
 
633
685
 
634
686
 
@@ -670,6 +722,10 @@ export declare class SkipList<K = any, V = any, R = [K, V]> extends IterableEntr
670
722
 
671
723
 
672
724
 
725
+
726
+
727
+
728
+
673
729
 
674
730
 
675
731
 
@@ -711,6 +767,10 @@ export declare class SkipList<K = any, V = any, R = [K, V]> extends IterableEntr
711
767
 
712
768
 
713
769
 
770
+
771
+
772
+
773
+
714
774
 
715
775
 
716
776
 
@@ -755,6 +815,10 @@ export declare class SkipList<K = any, V = any, R = [K, V]> extends IterableEntr
755
815
 
756
816
 
757
817
 
818
+
819
+
820
+
821
+
758
822
 
759
823
 
760
824
 
@@ -796,6 +860,10 @@ export declare class SkipList<K = any, V = any, R = [K, V]> extends IterableEntr
796
860
 
797
861
 
798
862
 
863
+
864
+
865
+
866
+
799
867
 
800
868
 
801
869
 
@@ -837,6 +905,10 @@ export declare class SkipList<K = any, V = any, R = [K, V]> extends IterableEntr
837
905
 
838
906
 
839
907
 
908
+
909
+
910
+
911
+
840
912
 
841
913
 
842
914
 
@@ -172,6 +172,10 @@ export declare class Matrix {
172
172
 
173
173
 
174
174
 
175
+
176
+
177
+
178
+
175
179
 
176
180
 
177
181
 
@@ -236,6 +240,10 @@ export declare class Matrix {
236
240
 
237
241
 
238
242
 
243
+
244
+
245
+
246
+
239
247
 
240
248
 
241
249
 
@@ -292,6 +300,10 @@ export declare class Matrix {
292
300
 
293
301
 
294
302
 
303
+
304
+
305
+
306
+
295
307
 
296
308
 
297
309
 
@@ -357,6 +369,10 @@ export declare class Matrix {
357
369
 
358
370
 
359
371
 
372
+
373
+
374
+
375
+
360
376
 
361
377
 
362
378
 
@@ -405,6 +421,10 @@ export declare class Matrix {
405
421
 
406
422
 
407
423
 
424
+
425
+
426
+
427
+
408
428
 
409
429
 
410
430
 
@@ -468,6 +488,10 @@ export declare class Matrix {
468
488
 
469
489
 
470
490
 
491
+
492
+
493
+
494
+
471
495
 
472
496
 
473
497
 
@@ -527,6 +551,10 @@ export declare class Matrix {
527
551
 
528
552
 
529
553
 
554
+
555
+
556
+
557
+
530
558
 
531
559
 
532
560
 
@@ -579,6 +607,10 @@ export declare class Matrix {
579
607
 
580
608
 
581
609
 
610
+
611
+
612
+
613
+
582
614
 
583
615
 
584
616