queue-typed 2.5.0 → 2.5.1
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 +882 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs-legacy/index.cjs +882 -0
- package/dist/cjs-legacy/index.cjs.map +1 -1
- package/dist/esm/index.mjs +882 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm-legacy/index.mjs +882 -0
- package/dist/esm-legacy/index.mjs.map +1 -1
- package/dist/types/data-structures/base/index.d.ts +1 -0
- package/dist/types/data-structures/base/iterable-entry-base.d.ts +8 -8
- package/dist/types/data-structures/base/linear-base.d.ts +3 -3
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +252 -0
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +294 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +527 -2
- package/dist/types/data-structures/binary-tree/bst.d.ts +505 -1
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +399 -0
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +126 -1
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +2881 -382
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +2867 -347
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +2328 -312
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +2671 -277
- package/dist/types/data-structures/graph/abstract-graph.d.ts +4 -4
- package/dist/types/data-structures/graph/directed-graph.d.ts +210 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +189 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +241 -10
- package/dist/types/data-structures/heap/heap.d.ts +294 -0
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +360 -3
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +318 -3
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +380 -2
- package/dist/types/data-structures/matrix/matrix.d.ts +168 -0
- package/dist/types/data-structures/queue/deque.d.ts +319 -4
- package/dist/types/data-structures/queue/queue.d.ts +252 -0
- package/dist/types/data-structures/stack/stack.d.ts +210 -0
- package/dist/types/data-structures/trie/trie.d.ts +256 -4
- package/dist/types/interfaces/graph.d.ts +1 -1
- package/dist/types/types/common.d.ts +2 -2
- package/dist/types/types/data-structures/heap/heap.d.ts +1 -0
- package/dist/types/types/data-structures/priority-queue/priority-queue.d.ts +1 -0
- package/dist/types/types/utils/validate-type.d.ts +4 -4
- package/dist/umd/queue-typed.js +882 -0
- package/dist/umd/queue-typed.js.map +1 -1
- package/dist/umd/queue-typed.min.js +1 -1
- package/dist/umd/queue-typed.min.js.map +1 -1
- package/package.json +2 -2
- package/src/data-structures/base/index.ts +1 -0
- package/src/data-structures/base/iterable-entry-base.ts +8 -8
- package/src/data-structures/base/linear-base.ts +3 -3
- package/src/data-structures/binary-tree/avl-tree.ts +252 -0
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +295 -1
- package/src/data-structures/binary-tree/binary-tree.ts +527 -2
- package/src/data-structures/binary-tree/bst.ts +505 -1
- package/src/data-structures/binary-tree/red-black-tree.ts +399 -0
- package/src/data-structures/binary-tree/segment-tree.ts +127 -2
- package/src/data-structures/binary-tree/tree-map.ts +2958 -459
- package/src/data-structures/binary-tree/tree-multi-map.ts +3069 -549
- package/src/data-structures/binary-tree/tree-multi-set.ts +2476 -460
- package/src/data-structures/binary-tree/tree-set.ts +2816 -422
- package/src/data-structures/graph/abstract-graph.ts +4 -4
- package/src/data-structures/graph/directed-graph.ts +210 -0
- package/src/data-structures/graph/undirected-graph.ts +189 -0
- package/src/data-structures/hash/hash-map.ts +246 -15
- package/src/data-structures/heap/heap.ts +294 -0
- package/src/data-structures/linked-list/doubly-linked-list.ts +360 -3
- package/src/data-structures/linked-list/singly-linked-list.ts +318 -3
- package/src/data-structures/linked-list/skip-linked-list.ts +380 -2
- package/src/data-structures/matrix/matrix.ts +169 -1
- package/src/data-structures/queue/deque.ts +320 -5
- package/src/data-structures/queue/queue.ts +252 -0
- package/src/data-structures/stack/stack.ts +210 -0
- package/src/data-structures/trie/trie.ts +257 -5
- package/src/interfaces/graph.ts +1 -1
- package/src/types/common.ts +2 -2
- package/src/types/data-structures/heap/heap.ts +1 -0
- package/src/types/data-structures/priority-queue/priority-queue.ts +1 -0
- package/src/types/utils/validate-type.ts +4 -4
|
@@ -734,6 +734,27 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
|
|
|
734
734
|
|
|
735
735
|
|
|
736
736
|
|
|
737
|
+
|
|
738
|
+
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
|
|
744
|
+
|
|
745
|
+
|
|
746
|
+
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
|
|
737
758
|
* @example
|
|
738
759
|
* // basic SinglyLinkedList creation and push operation
|
|
739
760
|
* // Create a simple SinglyLinkedList with initial values
|
|
@@ -777,6 +798,27 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
|
|
|
777
798
|
|
|
778
799
|
|
|
779
800
|
|
|
801
|
+
|
|
802
|
+
|
|
803
|
+
|
|
804
|
+
|
|
805
|
+
|
|
806
|
+
|
|
807
|
+
|
|
808
|
+
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
|
|
817
|
+
|
|
818
|
+
|
|
819
|
+
|
|
820
|
+
|
|
821
|
+
|
|
780
822
|
* @example
|
|
781
823
|
* // SinglyLinkedList pop and shift operations
|
|
782
824
|
* const list = new SinglyLinkedList<number>([10, 20, 30, 40, 50]);
|
|
@@ -826,6 +868,27 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
|
|
|
826
868
|
|
|
827
869
|
|
|
828
870
|
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
|
|
874
|
+
|
|
875
|
+
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
|
|
880
|
+
|
|
881
|
+
|
|
882
|
+
|
|
883
|
+
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
|
|
888
|
+
|
|
889
|
+
|
|
890
|
+
|
|
891
|
+
|
|
829
892
|
* @example
|
|
830
893
|
* // Remove from the front
|
|
831
894
|
* const list = new SinglyLinkedList<number>([10, 20, 30]);
|
|
@@ -856,6 +919,27 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
|
|
|
856
919
|
|
|
857
920
|
|
|
858
921
|
|
|
922
|
+
|
|
923
|
+
|
|
924
|
+
|
|
925
|
+
|
|
926
|
+
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
|
|
930
|
+
|
|
931
|
+
|
|
932
|
+
|
|
933
|
+
|
|
934
|
+
|
|
935
|
+
|
|
936
|
+
|
|
937
|
+
|
|
938
|
+
|
|
939
|
+
|
|
940
|
+
|
|
941
|
+
|
|
942
|
+
|
|
859
943
|
* @example
|
|
860
944
|
* // SinglyLinkedList unshift and forward traversal
|
|
861
945
|
* const list = new SinglyLinkedList<number>([20, 30, 40]);
|
|
@@ -947,6 +1031,27 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
|
|
|
947
1031
|
|
|
948
1032
|
|
|
949
1033
|
|
|
1034
|
+
|
|
1035
|
+
|
|
1036
|
+
|
|
1037
|
+
|
|
1038
|
+
|
|
1039
|
+
|
|
1040
|
+
|
|
1041
|
+
|
|
1042
|
+
|
|
1043
|
+
|
|
1044
|
+
|
|
1045
|
+
|
|
1046
|
+
|
|
1047
|
+
|
|
1048
|
+
|
|
1049
|
+
|
|
1050
|
+
|
|
1051
|
+
|
|
1052
|
+
|
|
1053
|
+
|
|
1054
|
+
|
|
950
1055
|
* @example
|
|
951
1056
|
* // Access element by index
|
|
952
1057
|
* const list = new SinglyLinkedList<string>(['a', 'b', 'c', 'd']);
|
|
@@ -982,6 +1087,27 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
|
|
|
982
1087
|
|
|
983
1088
|
|
|
984
1089
|
|
|
1090
|
+
|
|
1091
|
+
|
|
1092
|
+
|
|
1093
|
+
|
|
1094
|
+
|
|
1095
|
+
|
|
1096
|
+
|
|
1097
|
+
|
|
1098
|
+
|
|
1099
|
+
|
|
1100
|
+
|
|
1101
|
+
|
|
1102
|
+
|
|
1103
|
+
|
|
1104
|
+
|
|
1105
|
+
|
|
1106
|
+
|
|
1107
|
+
|
|
1108
|
+
|
|
1109
|
+
|
|
1110
|
+
|
|
985
1111
|
* @example
|
|
986
1112
|
* // Get node at index
|
|
987
1113
|
* const list = new SinglyLinkedList<string>(['a', 'b', 'c']);
|
|
@@ -1006,6 +1132,27 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
|
|
|
1006
1132
|
|
|
1007
1133
|
|
|
1008
1134
|
|
|
1135
|
+
|
|
1136
|
+
|
|
1137
|
+
|
|
1138
|
+
|
|
1139
|
+
|
|
1140
|
+
|
|
1141
|
+
|
|
1142
|
+
|
|
1143
|
+
|
|
1144
|
+
|
|
1145
|
+
|
|
1146
|
+
|
|
1147
|
+
|
|
1148
|
+
|
|
1149
|
+
|
|
1150
|
+
|
|
1151
|
+
|
|
1152
|
+
|
|
1153
|
+
|
|
1154
|
+
|
|
1155
|
+
|
|
1009
1156
|
* @example
|
|
1010
1157
|
* // Remove by index
|
|
1011
1158
|
* const list = new SinglyLinkedList<string>(['a', 'b', 'c']);
|
|
@@ -1036,6 +1183,27 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
|
|
|
1036
1183
|
|
|
1037
1184
|
|
|
1038
1185
|
|
|
1186
|
+
|
|
1187
|
+
|
|
1188
|
+
|
|
1189
|
+
|
|
1190
|
+
|
|
1191
|
+
|
|
1192
|
+
|
|
1193
|
+
|
|
1194
|
+
|
|
1195
|
+
|
|
1196
|
+
|
|
1197
|
+
|
|
1198
|
+
|
|
1199
|
+
|
|
1200
|
+
|
|
1201
|
+
|
|
1202
|
+
|
|
1203
|
+
|
|
1204
|
+
|
|
1205
|
+
|
|
1206
|
+
|
|
1039
1207
|
* @example
|
|
1040
1208
|
* // Remove first occurrence
|
|
1041
1209
|
* const list = new SinglyLinkedList<number>([1, 2, 3, 2]);
|
|
@@ -1071,6 +1239,27 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
|
|
|
1071
1239
|
|
|
1072
1240
|
|
|
1073
1241
|
|
|
1242
|
+
|
|
1243
|
+
|
|
1244
|
+
|
|
1245
|
+
|
|
1246
|
+
|
|
1247
|
+
|
|
1248
|
+
|
|
1249
|
+
|
|
1250
|
+
|
|
1251
|
+
|
|
1252
|
+
|
|
1253
|
+
|
|
1254
|
+
|
|
1255
|
+
|
|
1256
|
+
|
|
1257
|
+
|
|
1258
|
+
|
|
1259
|
+
|
|
1260
|
+
|
|
1261
|
+
|
|
1262
|
+
|
|
1074
1263
|
* @example
|
|
1075
1264
|
* // Insert at index
|
|
1076
1265
|
* const list = new SinglyLinkedList<number>([1, 3]);
|
|
@@ -1114,6 +1303,27 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
|
|
|
1114
1303
|
|
|
1115
1304
|
|
|
1116
1305
|
|
|
1306
|
+
|
|
1307
|
+
|
|
1308
|
+
|
|
1309
|
+
|
|
1310
|
+
|
|
1311
|
+
|
|
1312
|
+
|
|
1313
|
+
|
|
1314
|
+
|
|
1315
|
+
|
|
1316
|
+
|
|
1317
|
+
|
|
1318
|
+
|
|
1319
|
+
|
|
1320
|
+
|
|
1321
|
+
|
|
1322
|
+
|
|
1323
|
+
|
|
1324
|
+
|
|
1325
|
+
|
|
1326
|
+
|
|
1117
1327
|
* @example
|
|
1118
1328
|
* // Check empty
|
|
1119
1329
|
* console.log(new SinglyLinkedList().isEmpty()); // true;
|
|
@@ -1134,6 +1344,27 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
|
|
|
1134
1344
|
|
|
1135
1345
|
|
|
1136
1346
|
|
|
1347
|
+
|
|
1348
|
+
|
|
1349
|
+
|
|
1350
|
+
|
|
1351
|
+
|
|
1352
|
+
|
|
1353
|
+
|
|
1354
|
+
|
|
1355
|
+
|
|
1356
|
+
|
|
1357
|
+
|
|
1358
|
+
|
|
1359
|
+
|
|
1360
|
+
|
|
1361
|
+
|
|
1362
|
+
|
|
1363
|
+
|
|
1364
|
+
|
|
1365
|
+
|
|
1366
|
+
|
|
1367
|
+
|
|
1137
1368
|
* @example
|
|
1138
1369
|
* // Remove all
|
|
1139
1370
|
* const list = new SinglyLinkedList<number>([1, 2, 3]);
|
|
@@ -1160,6 +1391,27 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
|
|
|
1160
1391
|
|
|
1161
1392
|
|
|
1162
1393
|
|
|
1394
|
+
|
|
1395
|
+
|
|
1396
|
+
|
|
1397
|
+
|
|
1398
|
+
|
|
1399
|
+
|
|
1400
|
+
|
|
1401
|
+
|
|
1402
|
+
|
|
1403
|
+
|
|
1404
|
+
|
|
1405
|
+
|
|
1406
|
+
|
|
1407
|
+
|
|
1408
|
+
|
|
1409
|
+
|
|
1410
|
+
|
|
1411
|
+
|
|
1412
|
+
|
|
1413
|
+
|
|
1414
|
+
|
|
1163
1415
|
* @example
|
|
1164
1416
|
* // Reverse the list in-place
|
|
1165
1417
|
* const list = new SinglyLinkedList<number>([1, 2, 3, 4]);
|
|
@@ -1352,6 +1604,27 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
|
|
|
1352
1604
|
|
|
1353
1605
|
|
|
1354
1606
|
|
|
1607
|
+
|
|
1608
|
+
|
|
1609
|
+
|
|
1610
|
+
|
|
1611
|
+
|
|
1612
|
+
|
|
1613
|
+
|
|
1614
|
+
|
|
1615
|
+
|
|
1616
|
+
|
|
1617
|
+
|
|
1618
|
+
|
|
1619
|
+
|
|
1620
|
+
|
|
1621
|
+
|
|
1622
|
+
|
|
1623
|
+
|
|
1624
|
+
|
|
1625
|
+
|
|
1626
|
+
|
|
1627
|
+
|
|
1355
1628
|
* @example
|
|
1356
1629
|
* // Deep copy
|
|
1357
1630
|
* const list = new SinglyLinkedList<number>([1, 2, 3]);
|
|
@@ -1382,6 +1655,27 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
|
|
|
1382
1655
|
|
|
1383
1656
|
|
|
1384
1657
|
|
|
1658
|
+
|
|
1659
|
+
|
|
1660
|
+
|
|
1661
|
+
|
|
1662
|
+
|
|
1663
|
+
|
|
1664
|
+
|
|
1665
|
+
|
|
1666
|
+
|
|
1667
|
+
|
|
1668
|
+
|
|
1669
|
+
|
|
1670
|
+
|
|
1671
|
+
|
|
1672
|
+
|
|
1673
|
+
|
|
1674
|
+
|
|
1675
|
+
|
|
1676
|
+
|
|
1677
|
+
|
|
1678
|
+
|
|
1385
1679
|
* @example
|
|
1386
1680
|
* // SinglyLinkedList filter and map operations
|
|
1387
1681
|
* const list = new SinglyLinkedList<number>([1, 2, 3, 4, 5]);
|
|
@@ -1440,6 +1734,27 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
|
|
|
1440
1734
|
|
|
1441
1735
|
|
|
1442
1736
|
|
|
1737
|
+
|
|
1738
|
+
|
|
1739
|
+
|
|
1740
|
+
|
|
1741
|
+
|
|
1742
|
+
|
|
1743
|
+
|
|
1744
|
+
|
|
1745
|
+
|
|
1746
|
+
|
|
1747
|
+
|
|
1748
|
+
|
|
1749
|
+
|
|
1750
|
+
|
|
1751
|
+
|
|
1752
|
+
|
|
1753
|
+
|
|
1754
|
+
|
|
1755
|
+
|
|
1756
|
+
|
|
1757
|
+
|
|
1443
1758
|
* @example
|
|
1444
1759
|
* // Transform elements
|
|
1445
1760
|
* const list = new SinglyLinkedList<number>([1, 2, 3]);
|
|
@@ -1698,6 +2013,27 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1698
2013
|
|
|
1699
2014
|
|
|
1700
2015
|
|
|
2016
|
+
|
|
2017
|
+
|
|
2018
|
+
|
|
2019
|
+
|
|
2020
|
+
|
|
2021
|
+
|
|
2022
|
+
|
|
2023
|
+
|
|
2024
|
+
|
|
2025
|
+
|
|
2026
|
+
|
|
2027
|
+
|
|
2028
|
+
|
|
2029
|
+
|
|
2030
|
+
|
|
2031
|
+
|
|
2032
|
+
|
|
2033
|
+
|
|
2034
|
+
|
|
2035
|
+
|
|
2036
|
+
|
|
1701
2037
|
* @example
|
|
1702
2038
|
* // Track queue length
|
|
1703
2039
|
* const q = new Queue<number>();
|
|
@@ -1724,6 +2060,27 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1724
2060
|
|
|
1725
2061
|
|
|
1726
2062
|
|
|
2063
|
+
|
|
2064
|
+
|
|
2065
|
+
|
|
2066
|
+
|
|
2067
|
+
|
|
2068
|
+
|
|
2069
|
+
|
|
2070
|
+
|
|
2071
|
+
|
|
2072
|
+
|
|
2073
|
+
|
|
2074
|
+
|
|
2075
|
+
|
|
2076
|
+
|
|
2077
|
+
|
|
2078
|
+
|
|
2079
|
+
|
|
2080
|
+
|
|
2081
|
+
|
|
2082
|
+
|
|
2083
|
+
|
|
1727
2084
|
* @example
|
|
1728
2085
|
* // View the front element
|
|
1729
2086
|
* const q = new Queue<string>(['first', 'second', 'third']);
|
|
@@ -1766,6 +2123,27 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1766
2123
|
|
|
1767
2124
|
|
|
1768
2125
|
|
|
2126
|
+
|
|
2127
|
+
|
|
2128
|
+
|
|
2129
|
+
|
|
2130
|
+
|
|
2131
|
+
|
|
2132
|
+
|
|
2133
|
+
|
|
2134
|
+
|
|
2135
|
+
|
|
2136
|
+
|
|
2137
|
+
|
|
2138
|
+
|
|
2139
|
+
|
|
2140
|
+
|
|
2141
|
+
|
|
2142
|
+
|
|
2143
|
+
|
|
2144
|
+
|
|
2145
|
+
|
|
2146
|
+
|
|
1769
2147
|
* @example
|
|
1770
2148
|
* // Queue for...of iteration and isEmpty check
|
|
1771
2149
|
* const queue = new Queue<string>(['A', 'B', 'C', 'D']);
|
|
@@ -1804,6 +2182,27 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1804
2182
|
|
|
1805
2183
|
|
|
1806
2184
|
|
|
2185
|
+
|
|
2186
|
+
|
|
2187
|
+
|
|
2188
|
+
|
|
2189
|
+
|
|
2190
|
+
|
|
2191
|
+
|
|
2192
|
+
|
|
2193
|
+
|
|
2194
|
+
|
|
2195
|
+
|
|
2196
|
+
|
|
2197
|
+
|
|
2198
|
+
|
|
2199
|
+
|
|
2200
|
+
|
|
2201
|
+
|
|
2202
|
+
|
|
2203
|
+
|
|
2204
|
+
|
|
2205
|
+
|
|
1807
2206
|
* @example
|
|
1808
2207
|
* // basic Queue creation and push operation
|
|
1809
2208
|
* // Create a simple Queue with initial values
|
|
@@ -1849,6 +2248,27 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1849
2248
|
|
|
1850
2249
|
|
|
1851
2250
|
|
|
2251
|
+
|
|
2252
|
+
|
|
2253
|
+
|
|
2254
|
+
|
|
2255
|
+
|
|
2256
|
+
|
|
2257
|
+
|
|
2258
|
+
|
|
2259
|
+
|
|
2260
|
+
|
|
2261
|
+
|
|
2262
|
+
|
|
2263
|
+
|
|
2264
|
+
|
|
2265
|
+
|
|
2266
|
+
|
|
2267
|
+
|
|
2268
|
+
|
|
2269
|
+
|
|
2270
|
+
|
|
2271
|
+
|
|
1852
2272
|
* @example
|
|
1853
2273
|
* // Queue shift and peek operations
|
|
1854
2274
|
* const queue = new Queue<number>([10, 20, 30, 40]);
|
|
@@ -1884,6 +2304,27 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1884
2304
|
|
|
1885
2305
|
|
|
1886
2306
|
|
|
2307
|
+
|
|
2308
|
+
|
|
2309
|
+
|
|
2310
|
+
|
|
2311
|
+
|
|
2312
|
+
|
|
2313
|
+
|
|
2314
|
+
|
|
2315
|
+
|
|
2316
|
+
|
|
2317
|
+
|
|
2318
|
+
|
|
2319
|
+
|
|
2320
|
+
|
|
2321
|
+
|
|
2322
|
+
|
|
2323
|
+
|
|
2324
|
+
|
|
2325
|
+
|
|
2326
|
+
|
|
2327
|
+
|
|
1887
2328
|
* @example
|
|
1888
2329
|
* // Remove specific element
|
|
1889
2330
|
* const q = new Queue<number>([1, 2, 3, 2]);
|
|
@@ -1912,6 +2353,27 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1912
2353
|
|
|
1913
2354
|
|
|
1914
2355
|
|
|
2356
|
+
|
|
2357
|
+
|
|
2358
|
+
|
|
2359
|
+
|
|
2360
|
+
|
|
2361
|
+
|
|
2362
|
+
|
|
2363
|
+
|
|
2364
|
+
|
|
2365
|
+
|
|
2366
|
+
|
|
2367
|
+
|
|
2368
|
+
|
|
2369
|
+
|
|
2370
|
+
|
|
2371
|
+
|
|
2372
|
+
|
|
2373
|
+
|
|
2374
|
+
|
|
2375
|
+
|
|
2376
|
+
|
|
1915
2377
|
* @example
|
|
1916
2378
|
* // Access element by index
|
|
1917
2379
|
* const q = new Queue<string>(['a', 'b', 'c']);
|
|
@@ -1981,6 +2443,27 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1981
2443
|
|
|
1982
2444
|
|
|
1983
2445
|
|
|
2446
|
+
|
|
2447
|
+
|
|
2448
|
+
|
|
2449
|
+
|
|
2450
|
+
|
|
2451
|
+
|
|
2452
|
+
|
|
2453
|
+
|
|
2454
|
+
|
|
2455
|
+
|
|
2456
|
+
|
|
2457
|
+
|
|
2458
|
+
|
|
2459
|
+
|
|
2460
|
+
|
|
2461
|
+
|
|
2462
|
+
|
|
2463
|
+
|
|
2464
|
+
|
|
2465
|
+
|
|
2466
|
+
|
|
1984
2467
|
* @example
|
|
1985
2468
|
* // Remove all elements
|
|
1986
2469
|
* const q = new Queue<number>([1, 2, 3]);
|
|
@@ -2003,6 +2486,27 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
2003
2486
|
|
|
2004
2487
|
|
|
2005
2488
|
|
|
2489
|
+
|
|
2490
|
+
|
|
2491
|
+
|
|
2492
|
+
|
|
2493
|
+
|
|
2494
|
+
|
|
2495
|
+
|
|
2496
|
+
|
|
2497
|
+
|
|
2498
|
+
|
|
2499
|
+
|
|
2500
|
+
|
|
2501
|
+
|
|
2502
|
+
|
|
2503
|
+
|
|
2504
|
+
|
|
2505
|
+
|
|
2506
|
+
|
|
2507
|
+
|
|
2508
|
+
|
|
2509
|
+
|
|
2006
2510
|
* @example
|
|
2007
2511
|
* // Reclaim unused memory
|
|
2008
2512
|
* const q = new Queue<number>([1, 2, 3, 4, 5]);
|
|
@@ -2048,6 +2552,27 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
2048
2552
|
|
|
2049
2553
|
|
|
2050
2554
|
|
|
2555
|
+
|
|
2556
|
+
|
|
2557
|
+
|
|
2558
|
+
|
|
2559
|
+
|
|
2560
|
+
|
|
2561
|
+
|
|
2562
|
+
|
|
2563
|
+
|
|
2564
|
+
|
|
2565
|
+
|
|
2566
|
+
|
|
2567
|
+
|
|
2568
|
+
|
|
2569
|
+
|
|
2570
|
+
|
|
2571
|
+
|
|
2572
|
+
|
|
2573
|
+
|
|
2574
|
+
|
|
2575
|
+
|
|
2051
2576
|
* @example
|
|
2052
2577
|
* // Create independent copy
|
|
2053
2578
|
* const q = new Queue<number>([1, 2, 3]);
|
|
@@ -2077,6 +2602,27 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
2077
2602
|
|
|
2078
2603
|
|
|
2079
2604
|
|
|
2605
|
+
|
|
2606
|
+
|
|
2607
|
+
|
|
2608
|
+
|
|
2609
|
+
|
|
2610
|
+
|
|
2611
|
+
|
|
2612
|
+
|
|
2613
|
+
|
|
2614
|
+
|
|
2615
|
+
|
|
2616
|
+
|
|
2617
|
+
|
|
2618
|
+
|
|
2619
|
+
|
|
2620
|
+
|
|
2621
|
+
|
|
2622
|
+
|
|
2623
|
+
|
|
2624
|
+
|
|
2625
|
+
|
|
2080
2626
|
* @example
|
|
2081
2627
|
* // Filter elements
|
|
2082
2628
|
* const q = new Queue<number>([1, 2, 3, 4, 5]);
|
|
@@ -2110,6 +2656,27 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
2110
2656
|
|
|
2111
2657
|
|
|
2112
2658
|
|
|
2659
|
+
|
|
2660
|
+
|
|
2661
|
+
|
|
2662
|
+
|
|
2663
|
+
|
|
2664
|
+
|
|
2665
|
+
|
|
2666
|
+
|
|
2667
|
+
|
|
2668
|
+
|
|
2669
|
+
|
|
2670
|
+
|
|
2671
|
+
|
|
2672
|
+
|
|
2673
|
+
|
|
2674
|
+
|
|
2675
|
+
|
|
2676
|
+
|
|
2677
|
+
|
|
2678
|
+
|
|
2679
|
+
|
|
2113
2680
|
* @example
|
|
2114
2681
|
* // Transform elements
|
|
2115
2682
|
* const q = new Queue<number>([1, 2, 3]);
|
|
@@ -2364,6 +2931,27 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
2364
2931
|
|
|
2365
2932
|
|
|
2366
2933
|
|
|
2934
|
+
|
|
2935
|
+
|
|
2936
|
+
|
|
2937
|
+
|
|
2938
|
+
|
|
2939
|
+
|
|
2940
|
+
|
|
2941
|
+
|
|
2942
|
+
|
|
2943
|
+
|
|
2944
|
+
|
|
2945
|
+
|
|
2946
|
+
|
|
2947
|
+
|
|
2948
|
+
|
|
2949
|
+
|
|
2950
|
+
|
|
2951
|
+
|
|
2952
|
+
|
|
2953
|
+
|
|
2954
|
+
|
|
2367
2955
|
* @example
|
|
2368
2956
|
* // Deque peek at both ends
|
|
2369
2957
|
* const deque = new Deque<number>([10, 20, 30, 40, 50]);
|
|
@@ -2398,6 +2986,27 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
2398
2986
|
|
|
2399
2987
|
|
|
2400
2988
|
|
|
2989
|
+
|
|
2990
|
+
|
|
2991
|
+
|
|
2992
|
+
|
|
2993
|
+
|
|
2994
|
+
|
|
2995
|
+
|
|
2996
|
+
|
|
2997
|
+
|
|
2998
|
+
|
|
2999
|
+
|
|
3000
|
+
|
|
3001
|
+
|
|
3002
|
+
|
|
3003
|
+
|
|
3004
|
+
|
|
3005
|
+
|
|
3006
|
+
|
|
3007
|
+
|
|
3008
|
+
|
|
3009
|
+
|
|
2401
3010
|
* @example
|
|
2402
3011
|
* // Peek at the back element
|
|
2403
3012
|
* const dq = new Deque<string>(['a', 'b', 'c']);
|
|
@@ -2437,6 +3046,27 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
2437
3046
|
|
|
2438
3047
|
|
|
2439
3048
|
|
|
3049
|
+
|
|
3050
|
+
|
|
3051
|
+
|
|
3052
|
+
|
|
3053
|
+
|
|
3054
|
+
|
|
3055
|
+
|
|
3056
|
+
|
|
3057
|
+
|
|
3058
|
+
|
|
3059
|
+
|
|
3060
|
+
|
|
3061
|
+
|
|
3062
|
+
|
|
3063
|
+
|
|
3064
|
+
|
|
3065
|
+
|
|
3066
|
+
|
|
3067
|
+
|
|
3068
|
+
|
|
3069
|
+
|
|
2440
3070
|
* @example
|
|
2441
3071
|
* // basic Deque creation and push/pop operations
|
|
2442
3072
|
* // Create a simple Deque with initial values
|
|
@@ -2489,6 +3119,27 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
2489
3119
|
|
|
2490
3120
|
|
|
2491
3121
|
|
|
3122
|
+
|
|
3123
|
+
|
|
3124
|
+
|
|
3125
|
+
|
|
3126
|
+
|
|
3127
|
+
|
|
3128
|
+
|
|
3129
|
+
|
|
3130
|
+
|
|
3131
|
+
|
|
3132
|
+
|
|
3133
|
+
|
|
3134
|
+
|
|
3135
|
+
|
|
3136
|
+
|
|
3137
|
+
|
|
3138
|
+
|
|
3139
|
+
|
|
3140
|
+
|
|
3141
|
+
|
|
3142
|
+
|
|
2492
3143
|
* @example
|
|
2493
3144
|
* // Remove from the back
|
|
2494
3145
|
* const dq = new Deque<number>([1, 2, 3]);
|
|
@@ -2528,6 +3179,27 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
2528
3179
|
|
|
2529
3180
|
|
|
2530
3181
|
|
|
3182
|
+
|
|
3183
|
+
|
|
3184
|
+
|
|
3185
|
+
|
|
3186
|
+
|
|
3187
|
+
|
|
3188
|
+
|
|
3189
|
+
|
|
3190
|
+
|
|
3191
|
+
|
|
3192
|
+
|
|
3193
|
+
|
|
3194
|
+
|
|
3195
|
+
|
|
3196
|
+
|
|
3197
|
+
|
|
3198
|
+
|
|
3199
|
+
|
|
3200
|
+
|
|
3201
|
+
|
|
3202
|
+
|
|
2531
3203
|
* @example
|
|
2532
3204
|
* // Remove from the front
|
|
2533
3205
|
* const dq = new Deque<number>([1, 2, 3]);
|
|
@@ -2568,6 +3240,27 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
2568
3240
|
|
|
2569
3241
|
|
|
2570
3242
|
|
|
3243
|
+
|
|
3244
|
+
|
|
3245
|
+
|
|
3246
|
+
|
|
3247
|
+
|
|
3248
|
+
|
|
3249
|
+
|
|
3250
|
+
|
|
3251
|
+
|
|
3252
|
+
|
|
3253
|
+
|
|
3254
|
+
|
|
3255
|
+
|
|
3256
|
+
|
|
3257
|
+
|
|
3258
|
+
|
|
3259
|
+
|
|
3260
|
+
|
|
3261
|
+
|
|
3262
|
+
|
|
3263
|
+
|
|
2571
3264
|
* @example
|
|
2572
3265
|
* // Deque shift and unshift operations
|
|
2573
3266
|
* const deque = new Deque<number>([20, 30, 40]);
|
|
@@ -2649,6 +3342,27 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
2649
3342
|
|
|
2650
3343
|
|
|
2651
3344
|
|
|
3345
|
+
|
|
3346
|
+
|
|
3347
|
+
|
|
3348
|
+
|
|
3349
|
+
|
|
3350
|
+
|
|
3351
|
+
|
|
3352
|
+
|
|
3353
|
+
|
|
3354
|
+
|
|
3355
|
+
|
|
3356
|
+
|
|
3357
|
+
|
|
3358
|
+
|
|
3359
|
+
|
|
3360
|
+
|
|
3361
|
+
|
|
3362
|
+
|
|
3363
|
+
|
|
3364
|
+
|
|
3365
|
+
|
|
2652
3366
|
* @example
|
|
2653
3367
|
* // Check if empty
|
|
2654
3368
|
* const dq = new Deque();
|
|
@@ -2670,6 +3384,27 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
2670
3384
|
|
|
2671
3385
|
|
|
2672
3386
|
|
|
3387
|
+
|
|
3388
|
+
|
|
3389
|
+
|
|
3390
|
+
|
|
3391
|
+
|
|
3392
|
+
|
|
3393
|
+
|
|
3394
|
+
|
|
3395
|
+
|
|
3396
|
+
|
|
3397
|
+
|
|
3398
|
+
|
|
3399
|
+
|
|
3400
|
+
|
|
3401
|
+
|
|
3402
|
+
|
|
3403
|
+
|
|
3404
|
+
|
|
3405
|
+
|
|
3406
|
+
|
|
3407
|
+
|
|
2673
3408
|
* @example
|
|
2674
3409
|
* // Remove all elements
|
|
2675
3410
|
* const dq = new Deque<number>([1, 2, 3]);
|
|
@@ -2695,6 +3430,27 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
2695
3430
|
|
|
2696
3431
|
|
|
2697
3432
|
|
|
3433
|
+
|
|
3434
|
+
|
|
3435
|
+
|
|
3436
|
+
|
|
3437
|
+
|
|
3438
|
+
|
|
3439
|
+
|
|
3440
|
+
|
|
3441
|
+
|
|
3442
|
+
|
|
3443
|
+
|
|
3444
|
+
|
|
3445
|
+
|
|
3446
|
+
|
|
3447
|
+
|
|
3448
|
+
|
|
3449
|
+
|
|
3450
|
+
|
|
3451
|
+
|
|
3452
|
+
|
|
3453
|
+
|
|
2698
3454
|
* @example
|
|
2699
3455
|
* // Access by index
|
|
2700
3456
|
* const dq = new Deque<string>(['a', 'b', 'c']);
|
|
@@ -2871,6 +3627,27 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
2871
3627
|
|
|
2872
3628
|
|
|
2873
3629
|
|
|
3630
|
+
|
|
3631
|
+
|
|
3632
|
+
|
|
3633
|
+
|
|
3634
|
+
|
|
3635
|
+
|
|
3636
|
+
|
|
3637
|
+
|
|
3638
|
+
|
|
3639
|
+
|
|
3640
|
+
|
|
3641
|
+
|
|
3642
|
+
|
|
3643
|
+
|
|
3644
|
+
|
|
3645
|
+
|
|
3646
|
+
|
|
3647
|
+
|
|
3648
|
+
|
|
3649
|
+
|
|
3650
|
+
|
|
2874
3651
|
* @example
|
|
2875
3652
|
* // Remove element
|
|
2876
3653
|
* const dq = new Deque<number>([1, 2, 3]);
|
|
@@ -2934,6 +3711,27 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
2934
3711
|
|
|
2935
3712
|
|
|
2936
3713
|
|
|
3714
|
+
|
|
3715
|
+
|
|
3716
|
+
|
|
3717
|
+
|
|
3718
|
+
|
|
3719
|
+
|
|
3720
|
+
|
|
3721
|
+
|
|
3722
|
+
|
|
3723
|
+
|
|
3724
|
+
|
|
3725
|
+
|
|
3726
|
+
|
|
3727
|
+
|
|
3728
|
+
|
|
3729
|
+
|
|
3730
|
+
|
|
3731
|
+
|
|
3732
|
+
|
|
3733
|
+
|
|
3734
|
+
|
|
2937
3735
|
* @example
|
|
2938
3736
|
* // Deque for...of iteration and reverse
|
|
2939
3737
|
* const deque = new Deque<string>(['A', 'B', 'C', 'D']);
|
|
@@ -3022,6 +3820,27 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
3022
3820
|
|
|
3023
3821
|
|
|
3024
3822
|
|
|
3823
|
+
|
|
3824
|
+
|
|
3825
|
+
|
|
3826
|
+
|
|
3827
|
+
|
|
3828
|
+
|
|
3829
|
+
|
|
3830
|
+
|
|
3831
|
+
|
|
3832
|
+
|
|
3833
|
+
|
|
3834
|
+
|
|
3835
|
+
|
|
3836
|
+
|
|
3837
|
+
|
|
3838
|
+
|
|
3839
|
+
|
|
3840
|
+
|
|
3841
|
+
|
|
3842
|
+
|
|
3843
|
+
|
|
3025
3844
|
* @example
|
|
3026
3845
|
* // Reclaim memory
|
|
3027
3846
|
* const dq = new Deque<number>([1, 2, 3, 4, 5]);
|
|
@@ -3069,6 +3888,27 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
3069
3888
|
|
|
3070
3889
|
|
|
3071
3890
|
|
|
3891
|
+
|
|
3892
|
+
|
|
3893
|
+
|
|
3894
|
+
|
|
3895
|
+
|
|
3896
|
+
|
|
3897
|
+
|
|
3898
|
+
|
|
3899
|
+
|
|
3900
|
+
|
|
3901
|
+
|
|
3902
|
+
|
|
3903
|
+
|
|
3904
|
+
|
|
3905
|
+
|
|
3906
|
+
|
|
3907
|
+
|
|
3908
|
+
|
|
3909
|
+
|
|
3910
|
+
|
|
3911
|
+
|
|
3072
3912
|
* @example
|
|
3073
3913
|
* // Create independent copy
|
|
3074
3914
|
* const dq = new Deque<number>([1, 2, 3]);
|
|
@@ -3099,6 +3939,27 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
3099
3939
|
|
|
3100
3940
|
|
|
3101
3941
|
|
|
3942
|
+
|
|
3943
|
+
|
|
3944
|
+
|
|
3945
|
+
|
|
3946
|
+
|
|
3947
|
+
|
|
3948
|
+
|
|
3949
|
+
|
|
3950
|
+
|
|
3951
|
+
|
|
3952
|
+
|
|
3953
|
+
|
|
3954
|
+
|
|
3955
|
+
|
|
3956
|
+
|
|
3957
|
+
|
|
3958
|
+
|
|
3959
|
+
|
|
3960
|
+
|
|
3961
|
+
|
|
3962
|
+
|
|
3102
3963
|
* @example
|
|
3103
3964
|
* // Filter elements
|
|
3104
3965
|
* const dq = new Deque<number>([1, 2, 3, 4]);
|
|
@@ -3149,6 +4010,27 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
3149
4010
|
|
|
3150
4011
|
|
|
3151
4012
|
|
|
4013
|
+
|
|
4014
|
+
|
|
4015
|
+
|
|
4016
|
+
|
|
4017
|
+
|
|
4018
|
+
|
|
4019
|
+
|
|
4020
|
+
|
|
4021
|
+
|
|
4022
|
+
|
|
4023
|
+
|
|
4024
|
+
|
|
4025
|
+
|
|
4026
|
+
|
|
4027
|
+
|
|
4028
|
+
|
|
4029
|
+
|
|
4030
|
+
|
|
4031
|
+
|
|
4032
|
+
|
|
4033
|
+
|
|
3152
4034
|
* @example
|
|
3153
4035
|
* // Transform elements
|
|
3154
4036
|
* const dq = new Deque<number>([1, 2, 3]);
|