binary-tree-typed 2.5.0 → 2.5.1

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 (75) hide show
  1. package/dist/cjs/index.cjs +609 -0
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs-legacy/index.cjs +609 -0
  4. package/dist/cjs-legacy/index.cjs.map +1 -1
  5. package/dist/esm/index.mjs +609 -0
  6. package/dist/esm/index.mjs.map +1 -1
  7. package/dist/esm-legacy/index.mjs +609 -0
  8. package/dist/esm-legacy/index.mjs.map +1 -1
  9. package/dist/types/data-structures/base/index.d.ts +1 -0
  10. package/dist/types/data-structures/base/iterable-entry-base.d.ts +8 -8
  11. package/dist/types/data-structures/base/linear-base.d.ts +3 -3
  12. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +252 -0
  13. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +294 -0
  14. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +527 -2
  15. package/dist/types/data-structures/binary-tree/bst.d.ts +505 -1
  16. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +399 -0
  17. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +126 -1
  18. package/dist/types/data-structures/binary-tree/tree-map.d.ts +2881 -382
  19. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +2867 -347
  20. package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +2328 -312
  21. package/dist/types/data-structures/binary-tree/tree-set.d.ts +2671 -277
  22. package/dist/types/data-structures/graph/abstract-graph.d.ts +4 -4
  23. package/dist/types/data-structures/graph/directed-graph.d.ts +210 -0
  24. package/dist/types/data-structures/graph/undirected-graph.d.ts +189 -0
  25. package/dist/types/data-structures/hash/hash-map.d.ts +241 -10
  26. package/dist/types/data-structures/heap/heap.d.ts +294 -0
  27. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +360 -3
  28. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +318 -3
  29. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +380 -2
  30. package/dist/types/data-structures/matrix/matrix.d.ts +168 -0
  31. package/dist/types/data-structures/queue/deque.d.ts +319 -4
  32. package/dist/types/data-structures/queue/queue.d.ts +252 -0
  33. package/dist/types/data-structures/stack/stack.d.ts +210 -0
  34. package/dist/types/data-structures/trie/trie.d.ts +256 -4
  35. package/dist/types/interfaces/graph.d.ts +1 -1
  36. package/dist/types/types/common.d.ts +2 -2
  37. package/dist/types/types/data-structures/heap/heap.d.ts +1 -0
  38. package/dist/types/types/data-structures/priority-queue/priority-queue.d.ts +1 -0
  39. package/dist/types/types/utils/validate-type.d.ts +4 -4
  40. package/dist/umd/binary-tree-typed.js +609 -0
  41. package/dist/umd/binary-tree-typed.js.map +1 -1
  42. package/dist/umd/binary-tree-typed.min.js +5 -5
  43. package/dist/umd/binary-tree-typed.min.js.map +1 -1
  44. package/package.json +2 -2
  45. package/src/data-structures/base/index.ts +1 -0
  46. package/src/data-structures/base/iterable-entry-base.ts +8 -8
  47. package/src/data-structures/base/linear-base.ts +3 -3
  48. package/src/data-structures/binary-tree/avl-tree.ts +252 -0
  49. package/src/data-structures/binary-tree/binary-indexed-tree.ts +295 -1
  50. package/src/data-structures/binary-tree/binary-tree.ts +527 -2
  51. package/src/data-structures/binary-tree/bst.ts +505 -1
  52. package/src/data-structures/binary-tree/red-black-tree.ts +399 -0
  53. package/src/data-structures/binary-tree/segment-tree.ts +127 -2
  54. package/src/data-structures/binary-tree/tree-map.ts +2958 -459
  55. package/src/data-structures/binary-tree/tree-multi-map.ts +3069 -549
  56. package/src/data-structures/binary-tree/tree-multi-set.ts +2476 -460
  57. package/src/data-structures/binary-tree/tree-set.ts +2816 -422
  58. package/src/data-structures/graph/abstract-graph.ts +4 -4
  59. package/src/data-structures/graph/directed-graph.ts +210 -0
  60. package/src/data-structures/graph/undirected-graph.ts +189 -0
  61. package/src/data-structures/hash/hash-map.ts +246 -15
  62. package/src/data-structures/heap/heap.ts +294 -0
  63. package/src/data-structures/linked-list/doubly-linked-list.ts +360 -3
  64. package/src/data-structures/linked-list/singly-linked-list.ts +318 -3
  65. package/src/data-structures/linked-list/skip-linked-list.ts +380 -2
  66. package/src/data-structures/matrix/matrix.ts +169 -1
  67. package/src/data-structures/queue/deque.ts +320 -5
  68. package/src/data-structures/queue/queue.ts +252 -0
  69. package/src/data-structures/stack/stack.ts +210 -0
  70. package/src/data-structures/trie/trie.ts +257 -5
  71. package/src/interfaces/graph.ts +1 -1
  72. package/src/types/common.ts +2 -2
  73. package/src/types/data-structures/heap/heap.ts +1 -0
  74. package/src/types/data-structures/priority-queue/priority-queue.ts +1 -0
  75. package/src/types/utils/validate-type.ts +4 -4
@@ -196,6 +196,27 @@ export class Heap<E = any, R = any> extends IterableElementBase<E, R> {
196
196
 
197
197
 
198
198
 
199
+
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+
199
220
  * @example
200
221
  * // Track heap capacity
201
222
  * const heap = new Heap<number>();
@@ -270,6 +291,27 @@ export class Heap<E = any, R = any> extends IterableElementBase<E, R> {
270
291
 
271
292
 
272
293
 
294
+
295
+
296
+
297
+
298
+
299
+
300
+
301
+
302
+
303
+
304
+
305
+
306
+
307
+
308
+
309
+
310
+
311
+
312
+
313
+
314
+
273
315
  * @example
274
316
  * // basic Heap creation and add operation
275
317
  * // Create a min heap (default)
@@ -305,6 +347,27 @@ export class Heap<E = any, R = any> extends IterableElementBase<E, R> {
305
347
 
306
348
 
307
349
 
350
+
351
+
352
+
353
+
354
+
355
+
356
+
357
+
358
+
359
+
360
+
361
+
362
+
363
+
364
+
365
+
366
+
367
+
368
+
369
+
370
+
308
371
  * @example
309
372
  * // Add multiple elements
310
373
  * const heap = new Heap<number>([], { comparator: (a, b) => a - b });
@@ -342,6 +405,27 @@ export class Heap<E = any, R = any> extends IterableElementBase<E, R> {
342
405
 
343
406
 
344
407
 
408
+
409
+
410
+
411
+
412
+
413
+
414
+
415
+
416
+
417
+
418
+
419
+
420
+
421
+
422
+
423
+
424
+
425
+
426
+
427
+
428
+
345
429
  * @example
346
430
  * // Heap with custom comparator (MaxHeap behavior)
347
431
  * interface Task {
@@ -395,6 +479,27 @@ export class Heap<E = any, R = any> extends IterableElementBase<E, R> {
395
479
 
396
480
 
397
481
 
482
+
483
+
484
+
485
+
486
+
487
+
488
+
489
+
490
+
491
+
492
+
493
+
494
+
495
+
496
+
497
+
498
+
499
+
500
+
501
+
502
+
398
503
  * @example
399
504
  * // Heap for event processing with priority
400
505
  * interface Event {
@@ -473,6 +578,27 @@ export class Heap<E = any, R = any> extends IterableElementBase<E, R> {
473
578
 
474
579
 
475
580
 
581
+
582
+
583
+
584
+
585
+
586
+
587
+
588
+
589
+
590
+
591
+
592
+
593
+
594
+
595
+
596
+
597
+
598
+
599
+
600
+
601
+
476
602
  * @example
477
603
  * // Check if heap is empty
478
604
  * const heap = new Heap<number>([], { comparator: (a, b) => a - b });
@@ -498,6 +624,27 @@ export class Heap<E = any, R = any> extends IterableElementBase<E, R> {
498
624
 
499
625
 
500
626
 
627
+
628
+
629
+
630
+
631
+
632
+
633
+
634
+
635
+
636
+
637
+
638
+
639
+
640
+
641
+
642
+
643
+
644
+
645
+
646
+
647
+
501
648
  * @example
502
649
  * // Remove all elements
503
650
  * const heap = new Heap<number>([1, 2, 3], { comparator: (a, b) => a - b });
@@ -528,6 +675,27 @@ export class Heap<E = any, R = any> extends IterableElementBase<E, R> {
528
675
  * @returns True if found.
529
676
 
530
677
 
678
+
679
+
680
+
681
+
682
+
683
+
684
+
685
+
686
+
687
+
688
+
689
+
690
+
691
+
692
+
693
+
694
+
695
+
696
+
697
+
698
+
531
699
  * @example
532
700
  * // Check element existence
533
701
  * const heap = new Heap<number>([3, 1, 2], { comparator: (a, b) => a - b });
@@ -553,6 +721,27 @@ export class Heap<E = any, R = any> extends IterableElementBase<E, R> {
553
721
 
554
722
 
555
723
 
724
+
725
+
726
+
727
+
728
+
729
+
730
+
731
+
732
+
733
+
734
+
735
+
736
+
737
+
738
+
739
+
740
+
741
+
742
+
743
+
744
+
556
745
  * @example
557
746
  * // Remove specific element
558
747
  * const heap = new Heap<number>([3, 1, 4, 1, 5], { comparator: (a, b) => a - b });
@@ -628,6 +817,27 @@ export class Heap<E = any, R = any> extends IterableElementBase<E, R> {
628
817
  * @returns Array of visited elements.
629
818
 
630
819
 
820
+
821
+
822
+
823
+
824
+
825
+
826
+
827
+
828
+
829
+
830
+
831
+
832
+
833
+
834
+
835
+
836
+
837
+
838
+
839
+
840
+
631
841
  * @example
632
842
  * // Depth-first traversal
633
843
  * const heap = new Heap<number>([3, 1, 2], { comparator: (a, b) => a - b });
@@ -689,6 +899,27 @@ export class Heap<E = any, R = any> extends IterableElementBase<E, R> {
689
899
 
690
900
 
691
901
 
902
+
903
+
904
+
905
+
906
+
907
+
908
+
909
+
910
+
911
+
912
+
913
+
914
+
915
+
916
+
917
+
918
+
919
+
920
+
921
+
922
+
692
923
  * @example
693
924
  * // Sort elements using heap
694
925
  * const heap = new Heap<number>([5, 1, 3, 2, 4]);
@@ -720,6 +951,27 @@ export class Heap<E = any, R = any> extends IterableElementBase<E, R> {
720
951
 
721
952
 
722
953
 
954
+
955
+
956
+
957
+
958
+
959
+
960
+
961
+
962
+
963
+
964
+
965
+
966
+
967
+
968
+
969
+
970
+
971
+
972
+
973
+
974
+
723
975
  * @example
724
976
  * // Create independent copy
725
977
  * const heap = new Heap<number>([3, 1, 4], { comparator: (a, b) => a - b });
@@ -750,6 +1002,27 @@ export class Heap<E = any, R = any> extends IterableElementBase<E, R> {
750
1002
 
751
1003
 
752
1004
 
1005
+
1006
+
1007
+
1008
+
1009
+
1010
+
1011
+
1012
+
1013
+
1014
+
1015
+
1016
+
1017
+
1018
+
1019
+
1020
+
1021
+
1022
+
1023
+
1024
+
1025
+
753
1026
  * @example
754
1027
  * // Filter elements
755
1028
  * const heap = new Heap<number>([1, 2, 3, 4, 5], { comparator: (a, b) => a - b });
@@ -787,6 +1060,27 @@ export class Heap<E = any, R = any> extends IterableElementBase<E, R> {
787
1060
 
788
1061
 
789
1062
 
1063
+
1064
+
1065
+
1066
+
1067
+
1068
+
1069
+
1070
+
1071
+
1072
+
1073
+
1074
+
1075
+
1076
+
1077
+
1078
+
1079
+
1080
+
1081
+
1082
+
1083
+
790
1084
  * @example
791
1085
  * // Transform elements
792
1086
  * const heap = new Heap<number>([1, 2, 3], { comparator: (a, b) => a - b });