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/umd/deque-typed.js
CHANGED
|
@@ -655,6 +655,9 @@ var dequeTyped = (() => {
|
|
|
655
655
|
|
|
656
656
|
|
|
657
657
|
|
|
658
|
+
|
|
659
|
+
|
|
660
|
+
|
|
658
661
|
|
|
659
662
|
|
|
660
663
|
|
|
@@ -672,6 +675,31 @@ var dequeTyped = (() => {
|
|
|
672
675
|
* console.log(last); // 50;
|
|
673
676
|
*
|
|
674
677
|
* // Length unchanged
|
|
678
|
+
* console.log(deque.length); // 5;
|
|
679
|
+
*/
|
|
680
|
+
/**
|
|
681
|
+
* Peek at the front element without removing it (alias for `first`).
|
|
682
|
+
* @remarks Time O(1), Space O(1)
|
|
683
|
+
* @returns Front element or undefined.
|
|
684
|
+
*/
|
|
685
|
+
peek() {
|
|
686
|
+
return this.first;
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* Deque peek at both ends
|
|
690
|
+
* @example
|
|
691
|
+
* // Deque peek at both ends
|
|
692
|
+
* const deque = new Deque<number>([10, 20, 30, 40, 50]);
|
|
693
|
+
*
|
|
694
|
+
* // Get first element without removing
|
|
695
|
+
* const first = deque.at(0);
|
|
696
|
+
* console.log(first); // 10;
|
|
697
|
+
*
|
|
698
|
+
* // Get last element without removing
|
|
699
|
+
* const last = deque.at(deque.length - 1);
|
|
700
|
+
* console.log(last); // 50;
|
|
701
|
+
*
|
|
702
|
+
* // Length unchanged
|
|
675
703
|
* console.log(deque.length); // 5;
|
|
676
704
|
*/
|
|
677
705
|
get first() {
|
|
@@ -712,6 +740,10 @@ var dequeTyped = (() => {
|
|
|
712
740
|
|
|
713
741
|
|
|
714
742
|
|
|
743
|
+
|
|
744
|
+
|
|
745
|
+
|
|
746
|
+
|
|
715
747
|
|
|
716
748
|
|
|
717
749
|
|
|
@@ -775,6 +807,10 @@ var dequeTyped = (() => {
|
|
|
775
807
|
|
|
776
808
|
|
|
777
809
|
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
|
|
778
814
|
|
|
779
815
|
|
|
780
816
|
|
|
@@ -851,6 +887,10 @@ var dequeTyped = (() => {
|
|
|
851
887
|
|
|
852
888
|
|
|
853
889
|
|
|
890
|
+
|
|
891
|
+
|
|
892
|
+
|
|
893
|
+
|
|
854
894
|
|
|
855
895
|
|
|
856
896
|
|
|
@@ -914,6 +954,10 @@ var dequeTyped = (() => {
|
|
|
914
954
|
|
|
915
955
|
|
|
916
956
|
|
|
957
|
+
|
|
958
|
+
|
|
959
|
+
|
|
960
|
+
|
|
917
961
|
|
|
918
962
|
|
|
919
963
|
|
|
@@ -978,6 +1022,10 @@ var dequeTyped = (() => {
|
|
|
978
1022
|
|
|
979
1023
|
|
|
980
1024
|
|
|
1025
|
+
|
|
1026
|
+
|
|
1027
|
+
|
|
1028
|
+
|
|
981
1029
|
|
|
982
1030
|
|
|
983
1031
|
|
|
@@ -1083,6 +1131,10 @@ var dequeTyped = (() => {
|
|
|
1083
1131
|
|
|
1084
1132
|
|
|
1085
1133
|
|
|
1134
|
+
|
|
1135
|
+
|
|
1136
|
+
|
|
1137
|
+
|
|
1086
1138
|
|
|
1087
1139
|
|
|
1088
1140
|
|
|
@@ -1128,6 +1180,10 @@ var dequeTyped = (() => {
|
|
|
1128
1180
|
|
|
1129
1181
|
|
|
1130
1182
|
|
|
1183
|
+
|
|
1184
|
+
|
|
1185
|
+
|
|
1186
|
+
|
|
1131
1187
|
|
|
1132
1188
|
|
|
1133
1189
|
|
|
@@ -1177,6 +1233,10 @@ var dequeTyped = (() => {
|
|
|
1177
1233
|
|
|
1178
1234
|
|
|
1179
1235
|
|
|
1236
|
+
|
|
1237
|
+
|
|
1238
|
+
|
|
1239
|
+
|
|
1180
1240
|
|
|
1181
1241
|
|
|
1182
1242
|
|
|
@@ -1377,6 +1437,10 @@ var dequeTyped = (() => {
|
|
|
1377
1437
|
|
|
1378
1438
|
|
|
1379
1439
|
|
|
1440
|
+
|
|
1441
|
+
|
|
1442
|
+
|
|
1443
|
+
|
|
1380
1444
|
|
|
1381
1445
|
|
|
1382
1446
|
|
|
@@ -1464,6 +1528,10 @@ var dequeTyped = (() => {
|
|
|
1464
1528
|
|
|
1465
1529
|
|
|
1466
1530
|
|
|
1531
|
+
|
|
1532
|
+
|
|
1533
|
+
|
|
1534
|
+
|
|
1467
1535
|
|
|
1468
1536
|
|
|
1469
1537
|
|
|
@@ -1576,6 +1644,10 @@ var dequeTyped = (() => {
|
|
|
1576
1644
|
|
|
1577
1645
|
|
|
1578
1646
|
|
|
1647
|
+
|
|
1648
|
+
|
|
1649
|
+
|
|
1650
|
+
|
|
1579
1651
|
|
|
1580
1652
|
|
|
1581
1653
|
|
|
@@ -1647,6 +1719,10 @@ var dequeTyped = (() => {
|
|
|
1647
1719
|
|
|
1648
1720
|
|
|
1649
1721
|
|
|
1722
|
+
|
|
1723
|
+
|
|
1724
|
+
|
|
1725
|
+
|
|
1650
1726
|
|
|
1651
1727
|
|
|
1652
1728
|
|
|
@@ -1701,6 +1777,10 @@ var dequeTyped = (() => {
|
|
|
1701
1777
|
|
|
1702
1778
|
|
|
1703
1779
|
|
|
1780
|
+
|
|
1781
|
+
|
|
1782
|
+
|
|
1783
|
+
|
|
1704
1784
|
|
|
1705
1785
|
|
|
1706
1786
|
|
|
@@ -1775,6 +1855,10 @@ var dequeTyped = (() => {
|
|
|
1775
1855
|
|
|
1776
1856
|
|
|
1777
1857
|
|
|
1858
|
+
|
|
1859
|
+
|
|
1860
|
+
|
|
1861
|
+
|
|
1778
1862
|
|
|
1779
1863
|
|
|
1780
1864
|
|