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/cjs/index.cjs
CHANGED
|
@@ -641,6 +641,9 @@ var Deque = class extends LinearBase {
|
|
|
641
641
|
|
|
642
642
|
|
|
643
643
|
|
|
644
|
+
|
|
645
|
+
|
|
646
|
+
|
|
644
647
|
|
|
645
648
|
|
|
646
649
|
|
|
@@ -658,6 +661,31 @@ var Deque = class extends LinearBase {
|
|
|
658
661
|
* console.log(last); // 50;
|
|
659
662
|
*
|
|
660
663
|
* // Length unchanged
|
|
664
|
+
* console.log(deque.length); // 5;
|
|
665
|
+
*/
|
|
666
|
+
/**
|
|
667
|
+
* Peek at the front element without removing it (alias for `first`).
|
|
668
|
+
* @remarks Time O(1), Space O(1)
|
|
669
|
+
* @returns Front element or undefined.
|
|
670
|
+
*/
|
|
671
|
+
peek() {
|
|
672
|
+
return this.first;
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* Deque peek at both ends
|
|
676
|
+
* @example
|
|
677
|
+
* // Deque peek at both ends
|
|
678
|
+
* const deque = new Deque<number>([10, 20, 30, 40, 50]);
|
|
679
|
+
*
|
|
680
|
+
* // Get first element without removing
|
|
681
|
+
* const first = deque.at(0);
|
|
682
|
+
* console.log(first); // 10;
|
|
683
|
+
*
|
|
684
|
+
* // Get last element without removing
|
|
685
|
+
* const last = deque.at(deque.length - 1);
|
|
686
|
+
* console.log(last); // 50;
|
|
687
|
+
*
|
|
688
|
+
* // Length unchanged
|
|
661
689
|
* console.log(deque.length); // 5;
|
|
662
690
|
*/
|
|
663
691
|
get first() {
|
|
@@ -698,6 +726,10 @@ var Deque = class extends LinearBase {
|
|
|
698
726
|
|
|
699
727
|
|
|
700
728
|
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
|
|
701
733
|
|
|
702
734
|
|
|
703
735
|
|
|
@@ -761,6 +793,10 @@ var Deque = class extends LinearBase {
|
|
|
761
793
|
|
|
762
794
|
|
|
763
795
|
|
|
796
|
+
|
|
797
|
+
|
|
798
|
+
|
|
799
|
+
|
|
764
800
|
|
|
765
801
|
|
|
766
802
|
|
|
@@ -837,6 +873,10 @@ var Deque = class extends LinearBase {
|
|
|
837
873
|
|
|
838
874
|
|
|
839
875
|
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
|
|
840
880
|
|
|
841
881
|
|
|
842
882
|
|
|
@@ -900,6 +940,10 @@ var Deque = class extends LinearBase {
|
|
|
900
940
|
|
|
901
941
|
|
|
902
942
|
|
|
943
|
+
|
|
944
|
+
|
|
945
|
+
|
|
946
|
+
|
|
903
947
|
|
|
904
948
|
|
|
905
949
|
|
|
@@ -964,6 +1008,10 @@ var Deque = class extends LinearBase {
|
|
|
964
1008
|
|
|
965
1009
|
|
|
966
1010
|
|
|
1011
|
+
|
|
1012
|
+
|
|
1013
|
+
|
|
1014
|
+
|
|
967
1015
|
|
|
968
1016
|
|
|
969
1017
|
|
|
@@ -1069,6 +1117,10 @@ var Deque = class extends LinearBase {
|
|
|
1069
1117
|
|
|
1070
1118
|
|
|
1071
1119
|
|
|
1120
|
+
|
|
1121
|
+
|
|
1122
|
+
|
|
1123
|
+
|
|
1072
1124
|
|
|
1073
1125
|
|
|
1074
1126
|
|
|
@@ -1114,6 +1166,10 @@ var Deque = class extends LinearBase {
|
|
|
1114
1166
|
|
|
1115
1167
|
|
|
1116
1168
|
|
|
1169
|
+
|
|
1170
|
+
|
|
1171
|
+
|
|
1172
|
+
|
|
1117
1173
|
|
|
1118
1174
|
|
|
1119
1175
|
|
|
@@ -1163,6 +1219,10 @@ var Deque = class extends LinearBase {
|
|
|
1163
1219
|
|
|
1164
1220
|
|
|
1165
1221
|
|
|
1222
|
+
|
|
1223
|
+
|
|
1224
|
+
|
|
1225
|
+
|
|
1166
1226
|
|
|
1167
1227
|
|
|
1168
1228
|
|
|
@@ -1363,6 +1423,10 @@ var Deque = class extends LinearBase {
|
|
|
1363
1423
|
|
|
1364
1424
|
|
|
1365
1425
|
|
|
1426
|
+
|
|
1427
|
+
|
|
1428
|
+
|
|
1429
|
+
|
|
1366
1430
|
|
|
1367
1431
|
|
|
1368
1432
|
|
|
@@ -1450,6 +1514,10 @@ var Deque = class extends LinearBase {
|
|
|
1450
1514
|
|
|
1451
1515
|
|
|
1452
1516
|
|
|
1517
|
+
|
|
1518
|
+
|
|
1519
|
+
|
|
1520
|
+
|
|
1453
1521
|
|
|
1454
1522
|
|
|
1455
1523
|
|
|
@@ -1562,6 +1630,10 @@ var Deque = class extends LinearBase {
|
|
|
1562
1630
|
|
|
1563
1631
|
|
|
1564
1632
|
|
|
1633
|
+
|
|
1634
|
+
|
|
1635
|
+
|
|
1636
|
+
|
|
1565
1637
|
|
|
1566
1638
|
|
|
1567
1639
|
|
|
@@ -1633,6 +1705,10 @@ var Deque = class extends LinearBase {
|
|
|
1633
1705
|
|
|
1634
1706
|
|
|
1635
1707
|
|
|
1708
|
+
|
|
1709
|
+
|
|
1710
|
+
|
|
1711
|
+
|
|
1636
1712
|
|
|
1637
1713
|
|
|
1638
1714
|
|
|
@@ -1687,6 +1763,10 @@ var Deque = class extends LinearBase {
|
|
|
1687
1763
|
|
|
1688
1764
|
|
|
1689
1765
|
|
|
1766
|
+
|
|
1767
|
+
|
|
1768
|
+
|
|
1769
|
+
|
|
1690
1770
|
|
|
1691
1771
|
|
|
1692
1772
|
|
|
@@ -1761,6 +1841,10 @@ var Deque = class extends LinearBase {
|
|
|
1761
1841
|
|
|
1762
1842
|
|
|
1763
1843
|
|
|
1844
|
+
|
|
1845
|
+
|
|
1846
|
+
|
|
1847
|
+
|
|
1764
1848
|
|
|
1765
1849
|
|
|
1766
1850
|
|