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
|
@@ -635,6 +635,9 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
635
635
|
|
|
636
636
|
|
|
637
637
|
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
|
|
638
641
|
|
|
639
642
|
|
|
640
643
|
|
|
@@ -652,6 +655,31 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
652
655
|
* console.log(last); // 50;
|
|
653
656
|
*
|
|
654
657
|
* // Length unchanged
|
|
658
|
+
* console.log(deque.length); // 5;
|
|
659
|
+
*/
|
|
660
|
+
/**
|
|
661
|
+
* Peek at the front element without removing it (alias for `first`).
|
|
662
|
+
* @remarks Time O(1), Space O(1)
|
|
663
|
+
* @returns Front element or undefined.
|
|
664
|
+
*/
|
|
665
|
+
peek() {
|
|
666
|
+
return this.first;
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* Deque peek at both ends
|
|
670
|
+
* @example
|
|
671
|
+
* // Deque peek at both ends
|
|
672
|
+
* const deque = new Deque<number>([10, 20, 30, 40, 50]);
|
|
673
|
+
*
|
|
674
|
+
* // Get first element without removing
|
|
675
|
+
* const first = deque.at(0);
|
|
676
|
+
* console.log(first); // 10;
|
|
677
|
+
*
|
|
678
|
+
* // Get last element without removing
|
|
679
|
+
* const last = deque.at(deque.length - 1);
|
|
680
|
+
* console.log(last); // 50;
|
|
681
|
+
*
|
|
682
|
+
* // Length unchanged
|
|
655
683
|
* console.log(deque.length); // 5;
|
|
656
684
|
*/
|
|
657
685
|
get first() {
|
|
@@ -692,6 +720,10 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
692
720
|
|
|
693
721
|
|
|
694
722
|
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
|
|
695
727
|
|
|
696
728
|
|
|
697
729
|
|
|
@@ -755,6 +787,10 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
755
787
|
|
|
756
788
|
|
|
757
789
|
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
|
|
793
|
+
|
|
758
794
|
|
|
759
795
|
|
|
760
796
|
|
|
@@ -831,6 +867,10 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
831
867
|
|
|
832
868
|
|
|
833
869
|
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
|
|
834
874
|
|
|
835
875
|
|
|
836
876
|
|
|
@@ -894,6 +934,10 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
894
934
|
|
|
895
935
|
|
|
896
936
|
|
|
937
|
+
|
|
938
|
+
|
|
939
|
+
|
|
940
|
+
|
|
897
941
|
|
|
898
942
|
|
|
899
943
|
|
|
@@ -958,6 +1002,10 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
958
1002
|
|
|
959
1003
|
|
|
960
1004
|
|
|
1005
|
+
|
|
1006
|
+
|
|
1007
|
+
|
|
1008
|
+
|
|
961
1009
|
|
|
962
1010
|
|
|
963
1011
|
|
|
@@ -1063,6 +1111,10 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
1063
1111
|
|
|
1064
1112
|
|
|
1065
1113
|
|
|
1114
|
+
|
|
1115
|
+
|
|
1116
|
+
|
|
1117
|
+
|
|
1066
1118
|
|
|
1067
1119
|
|
|
1068
1120
|
|
|
@@ -1108,6 +1160,10 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
1108
1160
|
|
|
1109
1161
|
|
|
1110
1162
|
|
|
1163
|
+
|
|
1164
|
+
|
|
1165
|
+
|
|
1166
|
+
|
|
1111
1167
|
|
|
1112
1168
|
|
|
1113
1169
|
|
|
@@ -1157,6 +1213,10 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
1157
1213
|
|
|
1158
1214
|
|
|
1159
1215
|
|
|
1216
|
+
|
|
1217
|
+
|
|
1218
|
+
|
|
1219
|
+
|
|
1160
1220
|
|
|
1161
1221
|
|
|
1162
1222
|
|
|
@@ -1357,6 +1417,10 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
1357
1417
|
|
|
1358
1418
|
|
|
1359
1419
|
|
|
1420
|
+
|
|
1421
|
+
|
|
1422
|
+
|
|
1423
|
+
|
|
1360
1424
|
|
|
1361
1425
|
|
|
1362
1426
|
|
|
@@ -1444,6 +1508,10 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
1444
1508
|
|
|
1445
1509
|
|
|
1446
1510
|
|
|
1511
|
+
|
|
1512
|
+
|
|
1513
|
+
|
|
1514
|
+
|
|
1447
1515
|
|
|
1448
1516
|
|
|
1449
1517
|
|
|
@@ -1556,6 +1624,10 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
1556
1624
|
|
|
1557
1625
|
|
|
1558
1626
|
|
|
1627
|
+
|
|
1628
|
+
|
|
1629
|
+
|
|
1630
|
+
|
|
1559
1631
|
|
|
1560
1632
|
|
|
1561
1633
|
|
|
@@ -1627,6 +1699,10 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
1627
1699
|
|
|
1628
1700
|
|
|
1629
1701
|
|
|
1702
|
+
|
|
1703
|
+
|
|
1704
|
+
|
|
1705
|
+
|
|
1630
1706
|
|
|
1631
1707
|
|
|
1632
1708
|
|
|
@@ -1681,6 +1757,10 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
1681
1757
|
|
|
1682
1758
|
|
|
1683
1759
|
|
|
1760
|
+
|
|
1761
|
+
|
|
1762
|
+
|
|
1763
|
+
|
|
1684
1764
|
|
|
1685
1765
|
|
|
1686
1766
|
|
|
@@ -1755,6 +1835,10 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
1755
1835
|
|
|
1756
1836
|
|
|
1757
1837
|
|
|
1838
|
+
|
|
1839
|
+
|
|
1840
|
+
|
|
1841
|
+
|
|
1758
1842
|
|
|
1759
1843
|
|
|
1760
1844
|
|