priority-queue-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 (74) hide show
  1. package/dist/cjs/index.cjs +294 -0
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs-legacy/index.cjs +294 -0
  4. package/dist/cjs-legacy/index.cjs.map +1 -1
  5. package/dist/esm/index.mjs +294 -0
  6. package/dist/esm/index.mjs.map +1 -1
  7. package/dist/esm-legacy/index.mjs +294 -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/priority-queue-typed.js +294 -0
  41. package/dist/umd/priority-queue-typed.js.map +1 -1
  42. package/dist/umd/priority-queue-typed.min.js.map +1 -1
  43. package/package.json +2 -2
  44. package/src/data-structures/base/index.ts +1 -0
  45. package/src/data-structures/base/iterable-entry-base.ts +8 -8
  46. package/src/data-structures/base/linear-base.ts +3 -3
  47. package/src/data-structures/binary-tree/avl-tree.ts +252 -0
  48. package/src/data-structures/binary-tree/binary-indexed-tree.ts +295 -1
  49. package/src/data-structures/binary-tree/binary-tree.ts +527 -2
  50. package/src/data-structures/binary-tree/bst.ts +505 -1
  51. package/src/data-structures/binary-tree/red-black-tree.ts +399 -0
  52. package/src/data-structures/binary-tree/segment-tree.ts +127 -2
  53. package/src/data-structures/binary-tree/tree-map.ts +2958 -459
  54. package/src/data-structures/binary-tree/tree-multi-map.ts +3069 -549
  55. package/src/data-structures/binary-tree/tree-multi-set.ts +2476 -460
  56. package/src/data-structures/binary-tree/tree-set.ts +2816 -422
  57. package/src/data-structures/graph/abstract-graph.ts +4 -4
  58. package/src/data-structures/graph/directed-graph.ts +210 -0
  59. package/src/data-structures/graph/undirected-graph.ts +189 -0
  60. package/src/data-structures/hash/hash-map.ts +246 -15
  61. package/src/data-structures/heap/heap.ts +294 -0
  62. package/src/data-structures/linked-list/doubly-linked-list.ts +360 -3
  63. package/src/data-structures/linked-list/singly-linked-list.ts +318 -3
  64. package/src/data-structures/linked-list/skip-linked-list.ts +380 -2
  65. package/src/data-structures/matrix/matrix.ts +169 -1
  66. package/src/data-structures/queue/deque.ts +320 -5
  67. package/src/data-structures/queue/queue.ts +252 -0
  68. package/src/data-structures/stack/stack.ts +210 -0
  69. package/src/data-structures/trie/trie.ts +257 -5
  70. package/src/interfaces/graph.ts +1 -1
  71. package/src/types/common.ts +2 -2
  72. package/src/types/data-structures/heap/heap.ts +1 -0
  73. package/src/types/data-structures/priority-queue/priority-queue.ts +1 -0
  74. package/src/types/utils/validate-type.ts +4 -4
@@ -353,6 +353,27 @@ var priorityQueueTyped = (() => {
353
353
 
354
354
 
355
355
 
356
+
357
+
358
+
359
+
360
+
361
+
362
+
363
+
364
+
365
+
366
+
367
+
368
+
369
+
370
+
371
+
372
+
373
+
374
+
375
+
376
+
356
377
  * @example
357
378
  * // Track heap capacity
358
379
  * const heap = new Heap<number>();
@@ -416,6 +437,27 @@ var priorityQueueTyped = (() => {
416
437
 
417
438
 
418
439
 
440
+
441
+
442
+
443
+
444
+
445
+
446
+
447
+
448
+
449
+
450
+
451
+
452
+
453
+
454
+
455
+
456
+
457
+
458
+
459
+
460
+
419
461
  * @example
420
462
  * // basic Heap creation and add operation
421
463
  * // Create a min heap (default)
@@ -449,6 +491,27 @@ var priorityQueueTyped = (() => {
449
491
 
450
492
 
451
493
 
494
+
495
+
496
+
497
+
498
+
499
+
500
+
501
+
502
+
503
+
504
+
505
+
506
+
507
+
508
+
509
+
510
+
511
+
512
+
513
+
514
+
452
515
  * @example
453
516
  * // Add multiple elements
454
517
  * const heap = new Heap<number>([], { comparator: (a, b) => a - b });
@@ -484,6 +547,27 @@ var priorityQueueTyped = (() => {
484
547
 
485
548
 
486
549
 
550
+
551
+
552
+
553
+
554
+
555
+
556
+
557
+
558
+
559
+
560
+
561
+
562
+
563
+
564
+
565
+
566
+
567
+
568
+
569
+
570
+
487
571
  * @example
488
572
  * // Heap with custom comparator (MaxHeap behavior)
489
573
  * interface Task {
@@ -535,6 +619,27 @@ var priorityQueueTyped = (() => {
535
619
 
536
620
 
537
621
 
622
+
623
+
624
+
625
+
626
+
627
+
628
+
629
+
630
+
631
+
632
+
633
+
634
+
635
+
636
+
637
+
638
+
639
+
640
+
641
+
642
+
538
643
  * @example
539
644
  * // Heap for event processing with priority
540
645
  * interface Event {
@@ -611,6 +716,27 @@ var priorityQueueTyped = (() => {
611
716
 
612
717
 
613
718
 
719
+
720
+
721
+
722
+
723
+
724
+
725
+
726
+
727
+
728
+
729
+
730
+
731
+
732
+
733
+
734
+
735
+
736
+
737
+
738
+
739
+
614
740
  * @example
615
741
  * // Check if heap is empty
616
742
  * const heap = new Heap<number>([], { comparator: (a, b) => a - b });
@@ -634,6 +760,27 @@ var priorityQueueTyped = (() => {
634
760
 
635
761
 
636
762
 
763
+
764
+
765
+
766
+
767
+
768
+
769
+
770
+
771
+
772
+
773
+
774
+
775
+
776
+
777
+
778
+
779
+
780
+
781
+
782
+
783
+
637
784
  * @example
638
785
  * // Remove all elements
639
786
  * const heap = new Heap<number>([1, 2, 3], { comparator: (a, b) => a - b });
@@ -660,6 +807,27 @@ var priorityQueueTyped = (() => {
660
807
  * @returns True if found.
661
808
 
662
809
 
810
+
811
+
812
+
813
+
814
+
815
+
816
+
817
+
818
+
819
+
820
+
821
+
822
+
823
+
824
+
825
+
826
+
827
+
828
+
829
+
830
+
663
831
  * @example
664
832
  * // Check element existence
665
833
  * const heap = new Heap<number>([3, 1, 2], { comparator: (a, b) => a - b });
@@ -683,6 +851,27 @@ var priorityQueueTyped = (() => {
683
851
 
684
852
 
685
853
 
854
+
855
+
856
+
857
+
858
+
859
+
860
+
861
+
862
+
863
+
864
+
865
+
866
+
867
+
868
+
869
+
870
+
871
+
872
+
873
+
874
+
686
875
  * @example
687
876
  * // Remove specific element
688
877
  * const heap = new Heap<number>([3, 1, 4, 1, 5], { comparator: (a, b) => a - b });
@@ -752,6 +941,27 @@ var priorityQueueTyped = (() => {
752
941
  * @returns Array of visited elements.
753
942
 
754
943
 
944
+
945
+
946
+
947
+
948
+
949
+
950
+
951
+
952
+
953
+
954
+
955
+
956
+
957
+
958
+
959
+
960
+
961
+
962
+
963
+
964
+
755
965
  * @example
756
966
  * // Depth-first traversal
757
967
  * const heap = new Heap<number>([3, 1, 2], { comparator: (a, b) => a - b });
@@ -808,6 +1018,27 @@ var priorityQueueTyped = (() => {
808
1018
 
809
1019
 
810
1020
 
1021
+
1022
+
1023
+
1024
+
1025
+
1026
+
1027
+
1028
+
1029
+
1030
+
1031
+
1032
+
1033
+
1034
+
1035
+
1036
+
1037
+
1038
+
1039
+
1040
+
1041
+
811
1042
  * @example
812
1043
  * // Sort elements using heap
813
1044
  * const heap = new Heap<number>([5, 1, 3, 2, 4]);
@@ -837,6 +1068,27 @@ var priorityQueueTyped = (() => {
837
1068
 
838
1069
 
839
1070
 
1071
+
1072
+
1073
+
1074
+
1075
+
1076
+
1077
+
1078
+
1079
+
1080
+
1081
+
1082
+
1083
+
1084
+
1085
+
1086
+
1087
+
1088
+
1089
+
1090
+
1091
+
840
1092
  * @example
841
1093
  * // Create independent copy
842
1094
  * const heap = new Heap<number>([3, 1, 4], { comparator: (a, b) => a - b });
@@ -865,6 +1117,27 @@ var priorityQueueTyped = (() => {
865
1117
 
866
1118
 
867
1119
 
1120
+
1121
+
1122
+
1123
+
1124
+
1125
+
1126
+
1127
+
1128
+
1129
+
1130
+
1131
+
1132
+
1133
+
1134
+
1135
+
1136
+
1137
+
1138
+
1139
+
1140
+
868
1141
  * @example
869
1142
  * // Filter elements
870
1143
  * const heap = new Heap<number>([1, 2, 3, 4, 5], { comparator: (a, b) => a - b });
@@ -900,6 +1173,27 @@ var priorityQueueTyped = (() => {
900
1173
 
901
1174
 
902
1175
 
1176
+
1177
+
1178
+
1179
+
1180
+
1181
+
1182
+
1183
+
1184
+
1185
+
1186
+
1187
+
1188
+
1189
+
1190
+
1191
+
1192
+
1193
+
1194
+
1195
+
1196
+
903
1197
  * @example
904
1198
  * // Transform elements
905
1199
  * const heap = new Heap<number>([1, 2, 3], { comparator: (a, b) => a - b });