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.
- package/dist/cjs/index.cjs +84 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs-legacy/index.cjs +84 -0
- package/dist/cjs-legacy/index.cjs.map +1 -1
- package/dist/esm/index.mjs +84 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm-legacy/index.mjs +84 -0
- package/dist/esm-legacy/index.mjs.map +1 -1
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +50 -2
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +56 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +116 -15
- package/dist/types/data-structures/binary-tree/bst.d.ts +99 -3
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +79 -8
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +24 -0
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +520 -1
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +489 -1
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +393 -1
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +500 -1
- package/dist/types/data-structures/graph/directed-graph.d.ts +40 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +36 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +51 -6
- package/dist/types/data-structures/heap/heap.d.ts +98 -12
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +75 -0
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +61 -1
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +72 -0
- package/dist/types/data-structures/matrix/matrix.d.ts +32 -0
- package/dist/types/data-structures/queue/deque.d.ts +82 -0
- package/dist/types/data-structures/queue/queue.d.ts +61 -0
- package/dist/types/data-structures/stack/stack.d.ts +42 -2
- package/dist/types/data-structures/trie/trie.d.ts +48 -0
- package/dist/types/interfaces/binary-tree.d.ts +2 -3
- package/dist/umd/deque-typed.js +84 -0
- package/dist/umd/deque-typed.js.map +1 -1
- package/dist/umd/deque-typed.min.js +1 -1
- package/dist/umd/deque-typed.min.js.map +1 -1
- package/package.json +2 -2
- package/src/data-structures/binary-tree/avl-tree.ts +52 -5
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +56 -0
- package/src/data-structures/binary-tree/binary-tree.ts +167 -81
- package/src/data-structures/binary-tree/bst.ts +101 -7
- package/src/data-structures/binary-tree/red-black-tree.ts +82 -15
- package/src/data-structures/binary-tree/segment-tree.ts +24 -0
- package/src/data-structures/binary-tree/tree-map.ts +540 -3
- package/src/data-structures/binary-tree/tree-multi-map.ts +490 -2
- package/src/data-structures/binary-tree/tree-multi-set.ts +393 -1
- package/src/data-structures/binary-tree/tree-set.ts +520 -3
- package/src/data-structures/graph/directed-graph.ts +41 -1
- package/src/data-structures/graph/undirected-graph.ts +37 -1
- package/src/data-structures/hash/hash-map.ts +67 -12
- package/src/data-structures/heap/heap.ts +107 -19
- package/src/data-structures/linked-list/doubly-linked-list.ts +88 -0
- package/src/data-structures/linked-list/singly-linked-list.ts +61 -1
- package/src/data-structures/linked-list/skip-linked-list.ts +72 -0
- package/src/data-structures/matrix/matrix.ts +32 -0
- package/src/data-structures/queue/deque.ts +85 -0
- package/src/data-structures/queue/queue.ts +73 -0
- package/src/data-structures/stack/stack.ts +45 -5
- package/src/data-structures/trie/trie.ts +48 -0
- package/src/interfaces/binary-tree.ts +1 -9
package/dist/esm/index.mjs
CHANGED
|
@@ -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
|
|