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
|
@@ -637,6 +637,9 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
637
637
|
|
|
638
638
|
|
|
639
639
|
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
|
|
640
643
|
|
|
641
644
|
|
|
642
645
|
|
|
@@ -654,6 +657,31 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
654
657
|
* console.log(last); // 50;
|
|
655
658
|
*
|
|
656
659
|
* // Length unchanged
|
|
660
|
+
* console.log(deque.length); // 5;
|
|
661
|
+
*/
|
|
662
|
+
/**
|
|
663
|
+
* Peek at the front element without removing it (alias for `first`).
|
|
664
|
+
* @remarks Time O(1), Space O(1)
|
|
665
|
+
* @returns Front element or undefined.
|
|
666
|
+
*/
|
|
667
|
+
peek() {
|
|
668
|
+
return this.first;
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* Deque peek at both ends
|
|
672
|
+
* @example
|
|
673
|
+
* // Deque peek at both ends
|
|
674
|
+
* const deque = new Deque<number>([10, 20, 30, 40, 50]);
|
|
675
|
+
*
|
|
676
|
+
* // Get first element without removing
|
|
677
|
+
* const first = deque.at(0);
|
|
678
|
+
* console.log(first); // 10;
|
|
679
|
+
*
|
|
680
|
+
* // Get last element without removing
|
|
681
|
+
* const last = deque.at(deque.length - 1);
|
|
682
|
+
* console.log(last); // 50;
|
|
683
|
+
*
|
|
684
|
+
* // Length unchanged
|
|
657
685
|
* console.log(deque.length); // 5;
|
|
658
686
|
*/
|
|
659
687
|
get first() {
|
|
@@ -694,6 +722,10 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
694
722
|
|
|
695
723
|
|
|
696
724
|
|
|
725
|
+
|
|
726
|
+
|
|
727
|
+
|
|
728
|
+
|
|
697
729
|
|
|
698
730
|
|
|
699
731
|
|
|
@@ -757,6 +789,10 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
757
789
|
|
|
758
790
|
|
|
759
791
|
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
|
|
795
|
+
|
|
760
796
|
|
|
761
797
|
|
|
762
798
|
|
|
@@ -833,6 +869,10 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
833
869
|
|
|
834
870
|
|
|
835
871
|
|
|
872
|
+
|
|
873
|
+
|
|
874
|
+
|
|
875
|
+
|
|
836
876
|
|
|
837
877
|
|
|
838
878
|
|
|
@@ -896,6 +936,10 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
896
936
|
|
|
897
937
|
|
|
898
938
|
|
|
939
|
+
|
|
940
|
+
|
|
941
|
+
|
|
942
|
+
|
|
899
943
|
|
|
900
944
|
|
|
901
945
|
|
|
@@ -960,6 +1004,10 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
960
1004
|
|
|
961
1005
|
|
|
962
1006
|
|
|
1007
|
+
|
|
1008
|
+
|
|
1009
|
+
|
|
1010
|
+
|
|
963
1011
|
|
|
964
1012
|
|
|
965
1013
|
|
|
@@ -1065,6 +1113,10 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
1065
1113
|
|
|
1066
1114
|
|
|
1067
1115
|
|
|
1116
|
+
|
|
1117
|
+
|
|
1118
|
+
|
|
1119
|
+
|
|
1068
1120
|
|
|
1069
1121
|
|
|
1070
1122
|
|
|
@@ -1110,6 +1162,10 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
1110
1162
|
|
|
1111
1163
|
|
|
1112
1164
|
|
|
1165
|
+
|
|
1166
|
+
|
|
1167
|
+
|
|
1168
|
+
|
|
1113
1169
|
|
|
1114
1170
|
|
|
1115
1171
|
|
|
@@ -1159,6 +1215,10 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
1159
1215
|
|
|
1160
1216
|
|
|
1161
1217
|
|
|
1218
|
+
|
|
1219
|
+
|
|
1220
|
+
|
|
1221
|
+
|
|
1162
1222
|
|
|
1163
1223
|
|
|
1164
1224
|
|
|
@@ -1359,6 +1419,10 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
1359
1419
|
|
|
1360
1420
|
|
|
1361
1421
|
|
|
1422
|
+
|
|
1423
|
+
|
|
1424
|
+
|
|
1425
|
+
|
|
1362
1426
|
|
|
1363
1427
|
|
|
1364
1428
|
|
|
@@ -1446,6 +1510,10 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
1446
1510
|
|
|
1447
1511
|
|
|
1448
1512
|
|
|
1513
|
+
|
|
1514
|
+
|
|
1515
|
+
|
|
1516
|
+
|
|
1449
1517
|
|
|
1450
1518
|
|
|
1451
1519
|
|
|
@@ -1558,6 +1626,10 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
1558
1626
|
|
|
1559
1627
|
|
|
1560
1628
|
|
|
1629
|
+
|
|
1630
|
+
|
|
1631
|
+
|
|
1632
|
+
|
|
1561
1633
|
|
|
1562
1634
|
|
|
1563
1635
|
|
|
@@ -1629,6 +1701,10 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
1629
1701
|
|
|
1630
1702
|
|
|
1631
1703
|
|
|
1704
|
+
|
|
1705
|
+
|
|
1706
|
+
|
|
1707
|
+
|
|
1632
1708
|
|
|
1633
1709
|
|
|
1634
1710
|
|
|
@@ -1683,6 +1759,10 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
1683
1759
|
|
|
1684
1760
|
|
|
1685
1761
|
|
|
1762
|
+
|
|
1763
|
+
|
|
1764
|
+
|
|
1765
|
+
|
|
1686
1766
|
|
|
1687
1767
|
|
|
1688
1768
|
|
|
@@ -1757,6 +1837,10 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
1757
1837
|
|
|
1758
1838
|
|
|
1759
1839
|
|
|
1840
|
+
|
|
1841
|
+
|
|
1842
|
+
|
|
1843
|
+
|
|
1760
1844
|
|
|
1761
1845
|
|
|
1762
1846
|
|