max-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/max-priority-queue-typed.js +294 -0
  41. package/dist/umd/max-priority-queue-typed.js.map +1 -1
  42. package/dist/umd/max-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
@@ -245,6 +245,27 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
245
245
 
246
246
 
247
247
 
248
+
249
+
250
+
251
+
252
+
253
+
254
+
255
+
256
+
257
+
258
+
259
+
260
+
261
+
262
+
263
+
264
+
265
+
266
+
267
+
268
+
248
269
  * @example
249
270
  * // basic SinglyLinkedList creation and push operation
250
271
  * // Create a simple SinglyLinkedList with initial values
@@ -277,6 +298,27 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
277
298
 
278
299
 
279
300
 
301
+
302
+
303
+
304
+
305
+
306
+
307
+
308
+
309
+
310
+
311
+
312
+
313
+
314
+
315
+
316
+
317
+
318
+
319
+
320
+
321
+
280
322
  * @example
281
323
  * // SinglyLinkedList pop and shift operations
282
324
  * const list = new SinglyLinkedList<number>([10, 20, 30, 40, 50]);
@@ -309,6 +351,27 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
309
351
 
310
352
 
311
353
 
354
+
355
+
356
+
357
+
358
+
359
+
360
+
361
+
362
+
363
+
364
+
365
+
366
+
367
+
368
+
369
+
370
+
371
+
372
+
373
+
374
+
312
375
  * @example
313
376
  * // Remove from the front
314
377
  * const list = new SinglyLinkedList<number>([10, 20, 30]);
@@ -332,6 +395,27 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
332
395
 
333
396
 
334
397
 
398
+
399
+
400
+
401
+
402
+
403
+
404
+
405
+
406
+
407
+
408
+
409
+
410
+
411
+
412
+
413
+
414
+
415
+
416
+
417
+
418
+
335
419
  * @example
336
420
  * // SinglyLinkedList unshift and forward traversal
337
421
  * const list = new SinglyLinkedList<number>([20, 30, 40]);
@@ -391,6 +475,27 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
391
475
 
392
476
 
393
477
 
478
+
479
+
480
+
481
+
482
+
483
+
484
+
485
+
486
+
487
+
488
+
489
+
490
+
491
+
492
+
493
+
494
+
495
+
496
+
497
+
498
+
394
499
  * @example
395
500
  * // Access element by index
396
501
  * const list = new SinglyLinkedList<string>(['a', 'b', 'c', 'd']);
@@ -419,6 +524,27 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
419
524
 
420
525
 
421
526
 
527
+
528
+
529
+
530
+
531
+
532
+
533
+
534
+
535
+
536
+
537
+
538
+
539
+
540
+
541
+
542
+
543
+
544
+
545
+
546
+
547
+
422
548
  * @example
423
549
  * // Get node at index
424
550
  * const list = new SinglyLinkedList<string>(['a', 'b', 'c']);
@@ -438,6 +564,27 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
438
564
 
439
565
 
440
566
 
567
+
568
+
569
+
570
+
571
+
572
+
573
+
574
+
575
+
576
+
577
+
578
+
579
+
580
+
581
+
582
+
583
+
584
+
585
+
586
+
587
+
441
588
  * @example
442
589
  * // Remove by index
443
590
  * const list = new SinglyLinkedList<string>(['a', 'b', 'c']);
@@ -458,6 +605,27 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
458
605
 
459
606
 
460
607
 
608
+
609
+
610
+
611
+
612
+
613
+
614
+
615
+
616
+
617
+
618
+
619
+
620
+
621
+
622
+
623
+
624
+
625
+
626
+
627
+
628
+
461
629
  * @example
462
630
  * // Remove first occurrence
463
631
  * const list = new SinglyLinkedList<number>([1, 2, 3, 2]);
@@ -479,6 +647,27 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
479
647
 
480
648
 
481
649
 
650
+
651
+
652
+
653
+
654
+
655
+
656
+
657
+
658
+
659
+
660
+
661
+
662
+
663
+
664
+
665
+
666
+
667
+
668
+
669
+
670
+
482
671
  * @example
483
672
  * // Insert at index
484
673
  * const list = new SinglyLinkedList<number>([1, 3]);
@@ -507,6 +696,27 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
507
696
 
508
697
 
509
698
 
699
+
700
+
701
+
702
+
703
+
704
+
705
+
706
+
707
+
708
+
709
+
710
+
711
+
712
+
713
+
714
+
715
+
716
+
717
+
718
+
719
+
510
720
  * @example
511
721
  * // Check empty
512
722
  * console.log(new SinglyLinkedList().isEmpty()); // true;
@@ -525,6 +735,27 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
525
735
 
526
736
 
527
737
 
738
+
739
+
740
+
741
+
742
+
743
+
744
+
745
+
746
+
747
+
748
+
749
+
750
+
751
+
752
+
753
+
754
+
755
+
756
+
757
+
758
+
528
759
  * @example
529
760
  * // Remove all
530
761
  * const list = new SinglyLinkedList<number>([1, 2, 3]);
@@ -547,6 +778,27 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
547
778
 
548
779
 
549
780
 
781
+
782
+
783
+
784
+
785
+
786
+
787
+
788
+
789
+
790
+
791
+
792
+
793
+
794
+
795
+
796
+
797
+
798
+
799
+
800
+
801
+
550
802
  * @example
551
803
  * // Reverse the list in-place
552
804
  * const list = new SinglyLinkedList<number>([1, 2, 3, 4]);
@@ -620,6 +872,27 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
620
872
 
621
873
 
622
874
 
875
+
876
+
877
+
878
+
879
+
880
+
881
+
882
+
883
+
884
+
885
+
886
+
887
+
888
+
889
+
890
+
891
+
892
+
893
+
894
+
895
+
623
896
  * @example
624
897
  * // Deep copy
625
898
  * const list = new SinglyLinkedList<number>([1, 2, 3]);
@@ -646,6 +919,27 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
646
919
 
647
920
 
648
921
 
922
+
923
+
924
+
925
+
926
+
927
+
928
+
929
+
930
+
931
+
932
+
933
+
934
+
935
+
936
+
937
+
938
+
939
+
940
+
941
+
942
+
649
943
  * @example
650
944
  * // SinglyLinkedList filter and map operations
651
945
  * const list = new SinglyLinkedList<number>([1, 2, 3, 4, 5]);
@@ -662,7 +956,7 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
662
956
  * const sum = list.reduce((acc, value) => acc + value, 0);
663
957
  * console.log(sum); // 15;
664
958
  */
665
- filter(callback: ElementCallback<E, R, boolean>, thisArg?: any): this;
959
+ filter(callback: ElementCallback<E, R, boolean>, thisArg?: unknown): this;
666
960
  /**
667
961
  * Map values into a new list of the same class.
668
962
  * @remarks Time O(N), Space O(N)
@@ -670,7 +964,7 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
670
964
  * @param [thisArg] - Value for `this` inside the callback.
671
965
  * @returns A new list with mapped values.
672
966
  */
673
- mapSame(callback: ElementCallback<E, R, E>, thisArg?: any): this;
967
+ mapSame(callback: ElementCallback<E, R, E>, thisArg?: unknown): this;
674
968
  /**
675
969
  * Map values into a new list (possibly different element type).
676
970
  * @remarks Time O(N), Space O(N)
@@ -691,13 +985,34 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
691
985
 
692
986
 
693
987
 
988
+
989
+
990
+
991
+
992
+
993
+
994
+
995
+
996
+
997
+
998
+
999
+
1000
+
1001
+
1002
+
1003
+
1004
+
1005
+
1006
+
1007
+
1008
+
694
1009
  * @example
695
1010
  * // Transform elements
696
1011
  * const list = new SinglyLinkedList<number>([1, 2, 3]);
697
1012
  * const doubled = list.map(n => n * 2);
698
1013
  * console.log([...doubled]); // [2, 4, 6];
699
1014
  */
700
- map<EM, RM = any>(callback: ElementCallback<E, R, EM>, options?: SinglyLinkedListOptions<EM, RM>, thisArg?: any): SinglyLinkedList<EM, RM>;
1015
+ map<EM, RM = any>(callback: ElementCallback<E, R, EM>, options?: SinglyLinkedListOptions<EM, RM>, thisArg?: unknown): SinglyLinkedList<EM, RM>;
701
1016
  /**
702
1017
  * (Protected) Create a node from a value.
703
1018
  * @remarks Time O(1), Space O(1)