deque-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 +84 -0
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs-legacy/index.cjs +84 -0
  4. package/dist/cjs-legacy/index.cjs.map +1 -1
  5. package/dist/esm/index.mjs +84 -0
  6. package/dist/esm/index.mjs.map +1 -1
  7. package/dist/esm-legacy/index.mjs +84 -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/deque-typed.js +84 -0
  33. package/dist/umd/deque-typed.js.map +1 -1
  34. package/dist/umd/deque-typed.min.js +1 -1
  35. package/dist/umd/deque-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
@@ -639,6 +639,9 @@ var Deque = class extends LinearBase {
639
639
 
640
640
 
641
641
 
642
+
643
+
644
+
642
645
 
643
646
 
644
647
 
@@ -656,6 +659,31 @@ var Deque = class extends LinearBase {
656
659
  * console.log(last); // 50;
657
660
  *
658
661
  * // Length unchanged
662
+ * console.log(deque.length); // 5;
663
+ */
664
+ /**
665
+ * Peek at the front element without removing it (alias for `first`).
666
+ * @remarks Time O(1), Space O(1)
667
+ * @returns Front element or undefined.
668
+ */
669
+ peek() {
670
+ return this.first;
671
+ }
672
+ /**
673
+ * Deque peek at both ends
674
+ * @example
675
+ * // Deque peek at both ends
676
+ * const deque = new Deque<number>([10, 20, 30, 40, 50]);
677
+ *
678
+ * // Get first element without removing
679
+ * const first = deque.at(0);
680
+ * console.log(first); // 10;
681
+ *
682
+ * // Get last element without removing
683
+ * const last = deque.at(deque.length - 1);
684
+ * console.log(last); // 50;
685
+ *
686
+ * // Length unchanged
659
687
  * console.log(deque.length); // 5;
660
688
  */
661
689
  get first() {
@@ -696,6 +724,10 @@ var Deque = class extends LinearBase {
696
724
 
697
725
 
698
726
 
727
+
728
+
729
+
730
+
699
731
 
700
732
 
701
733
 
@@ -759,6 +791,10 @@ var Deque = class extends LinearBase {
759
791
 
760
792
 
761
793
 
794
+
795
+
796
+
797
+
762
798
 
763
799
 
764
800
 
@@ -835,6 +871,10 @@ var Deque = class extends LinearBase {
835
871
 
836
872
 
837
873
 
874
+
875
+
876
+
877
+
838
878
 
839
879
 
840
880
 
@@ -898,6 +938,10 @@ var Deque = class extends LinearBase {
898
938
 
899
939
 
900
940
 
941
+
942
+
943
+
944
+
901
945
 
902
946
 
903
947
 
@@ -962,6 +1006,10 @@ var Deque = class extends LinearBase {
962
1006
 
963
1007
 
964
1008
 
1009
+
1010
+
1011
+
1012
+
965
1013
 
966
1014
 
967
1015
 
@@ -1067,6 +1115,10 @@ var Deque = class extends LinearBase {
1067
1115
 
1068
1116
 
1069
1117
 
1118
+
1119
+
1120
+
1121
+
1070
1122
 
1071
1123
 
1072
1124
 
@@ -1112,6 +1164,10 @@ var Deque = class extends LinearBase {
1112
1164
 
1113
1165
 
1114
1166
 
1167
+
1168
+
1169
+
1170
+
1115
1171
 
1116
1172
 
1117
1173
 
@@ -1161,6 +1217,10 @@ var Deque = class extends LinearBase {
1161
1217
 
1162
1218
 
1163
1219
 
1220
+
1221
+
1222
+
1223
+
1164
1224
 
1165
1225
 
1166
1226
 
@@ -1361,6 +1421,10 @@ var Deque = class extends LinearBase {
1361
1421
 
1362
1422
 
1363
1423
 
1424
+
1425
+
1426
+
1427
+
1364
1428
 
1365
1429
 
1366
1430
 
@@ -1448,6 +1512,10 @@ var Deque = class extends LinearBase {
1448
1512
 
1449
1513
 
1450
1514
 
1515
+
1516
+
1517
+
1518
+
1451
1519
 
1452
1520
 
1453
1521
 
@@ -1560,6 +1628,10 @@ var Deque = class extends LinearBase {
1560
1628
 
1561
1629
 
1562
1630
 
1631
+
1632
+
1633
+
1634
+
1563
1635
 
1564
1636
 
1565
1637
 
@@ -1631,6 +1703,10 @@ var Deque = class extends LinearBase {
1631
1703
 
1632
1704
 
1633
1705
 
1706
+
1707
+
1708
+
1709
+
1634
1710
 
1635
1711
 
1636
1712
 
@@ -1685,6 +1761,10 @@ var Deque = class extends LinearBase {
1685
1761
 
1686
1762
 
1687
1763
 
1764
+
1765
+
1766
+
1767
+
1688
1768
 
1689
1769
 
1690
1770
 
@@ -1759,6 +1839,10 @@ var Deque = class extends LinearBase {
1759
1839
 
1760
1840
 
1761
1841
 
1842
+
1843
+
1844
+
1845
+
1762
1846
 
1763
1847
 
1764
1848