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
package/dist/cjs/index.cjs
CHANGED
|
@@ -740,6 +740,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
740
740
|
|
|
741
741
|
|
|
742
742
|
|
|
743
|
+
|
|
744
|
+
|
|
745
|
+
|
|
746
|
+
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
|
|
761
|
+
|
|
762
|
+
|
|
763
|
+
|
|
743
764
|
* @example
|
|
744
765
|
* // basic SinglyLinkedList creation and push operation
|
|
745
766
|
* // Create a simple SinglyLinkedList with initial values
|
|
@@ -783,6 +804,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
783
804
|
|
|
784
805
|
|
|
785
806
|
|
|
807
|
+
|
|
808
|
+
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
|
|
817
|
+
|
|
818
|
+
|
|
819
|
+
|
|
820
|
+
|
|
821
|
+
|
|
822
|
+
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
|
|
786
828
|
* @example
|
|
787
829
|
* // SinglyLinkedList pop and shift operations
|
|
788
830
|
* const list = new SinglyLinkedList<number>([10, 20, 30, 40, 50]);
|
|
@@ -831,6 +873,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
831
873
|
|
|
832
874
|
|
|
833
875
|
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
|
|
880
|
+
|
|
881
|
+
|
|
882
|
+
|
|
883
|
+
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
|
|
888
|
+
|
|
889
|
+
|
|
890
|
+
|
|
891
|
+
|
|
892
|
+
|
|
893
|
+
|
|
894
|
+
|
|
895
|
+
|
|
896
|
+
|
|
834
897
|
* @example
|
|
835
898
|
* // Remove from the front
|
|
836
899
|
* const list = new SinglyLinkedList<number>([10, 20, 30]);
|
|
@@ -861,6 +924,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
861
924
|
|
|
862
925
|
|
|
863
926
|
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
|
|
930
|
+
|
|
931
|
+
|
|
932
|
+
|
|
933
|
+
|
|
934
|
+
|
|
935
|
+
|
|
936
|
+
|
|
937
|
+
|
|
938
|
+
|
|
939
|
+
|
|
940
|
+
|
|
941
|
+
|
|
942
|
+
|
|
943
|
+
|
|
944
|
+
|
|
945
|
+
|
|
946
|
+
|
|
947
|
+
|
|
864
948
|
* @example
|
|
865
949
|
* // SinglyLinkedList unshift and forward traversal
|
|
866
950
|
* const list = new SinglyLinkedList<number>([20, 30, 40]);
|
|
@@ -952,6 +1036,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
952
1036
|
|
|
953
1037
|
|
|
954
1038
|
|
|
1039
|
+
|
|
1040
|
+
|
|
1041
|
+
|
|
1042
|
+
|
|
1043
|
+
|
|
1044
|
+
|
|
1045
|
+
|
|
1046
|
+
|
|
1047
|
+
|
|
1048
|
+
|
|
1049
|
+
|
|
1050
|
+
|
|
1051
|
+
|
|
1052
|
+
|
|
1053
|
+
|
|
1054
|
+
|
|
1055
|
+
|
|
1056
|
+
|
|
1057
|
+
|
|
1058
|
+
|
|
1059
|
+
|
|
955
1060
|
* @example
|
|
956
1061
|
* // Access element by index
|
|
957
1062
|
* const list = new SinglyLinkedList<string>(['a', 'b', 'c', 'd']);
|
|
@@ -987,6 +1092,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
987
1092
|
|
|
988
1093
|
|
|
989
1094
|
|
|
1095
|
+
|
|
1096
|
+
|
|
1097
|
+
|
|
1098
|
+
|
|
1099
|
+
|
|
1100
|
+
|
|
1101
|
+
|
|
1102
|
+
|
|
1103
|
+
|
|
1104
|
+
|
|
1105
|
+
|
|
1106
|
+
|
|
1107
|
+
|
|
1108
|
+
|
|
1109
|
+
|
|
1110
|
+
|
|
1111
|
+
|
|
1112
|
+
|
|
1113
|
+
|
|
1114
|
+
|
|
1115
|
+
|
|
990
1116
|
* @example
|
|
991
1117
|
* // Get node at index
|
|
992
1118
|
* const list = new SinglyLinkedList<string>(['a', 'b', 'c']);
|
|
@@ -1011,6 +1137,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1011
1137
|
|
|
1012
1138
|
|
|
1013
1139
|
|
|
1140
|
+
|
|
1141
|
+
|
|
1142
|
+
|
|
1143
|
+
|
|
1144
|
+
|
|
1145
|
+
|
|
1146
|
+
|
|
1147
|
+
|
|
1148
|
+
|
|
1149
|
+
|
|
1150
|
+
|
|
1151
|
+
|
|
1152
|
+
|
|
1153
|
+
|
|
1154
|
+
|
|
1155
|
+
|
|
1156
|
+
|
|
1157
|
+
|
|
1158
|
+
|
|
1159
|
+
|
|
1160
|
+
|
|
1014
1161
|
* @example
|
|
1015
1162
|
* // Remove by index
|
|
1016
1163
|
* const list = new SinglyLinkedList<string>(['a', 'b', 'c']);
|
|
@@ -1041,6 +1188,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1041
1188
|
|
|
1042
1189
|
|
|
1043
1190
|
|
|
1191
|
+
|
|
1192
|
+
|
|
1193
|
+
|
|
1194
|
+
|
|
1195
|
+
|
|
1196
|
+
|
|
1197
|
+
|
|
1198
|
+
|
|
1199
|
+
|
|
1200
|
+
|
|
1201
|
+
|
|
1202
|
+
|
|
1203
|
+
|
|
1204
|
+
|
|
1205
|
+
|
|
1206
|
+
|
|
1207
|
+
|
|
1208
|
+
|
|
1209
|
+
|
|
1210
|
+
|
|
1211
|
+
|
|
1044
1212
|
* @example
|
|
1045
1213
|
* // Remove first occurrence
|
|
1046
1214
|
* const list = new SinglyLinkedList<number>([1, 2, 3, 2]);
|
|
@@ -1076,6 +1244,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1076
1244
|
|
|
1077
1245
|
|
|
1078
1246
|
|
|
1247
|
+
|
|
1248
|
+
|
|
1249
|
+
|
|
1250
|
+
|
|
1251
|
+
|
|
1252
|
+
|
|
1253
|
+
|
|
1254
|
+
|
|
1255
|
+
|
|
1256
|
+
|
|
1257
|
+
|
|
1258
|
+
|
|
1259
|
+
|
|
1260
|
+
|
|
1261
|
+
|
|
1262
|
+
|
|
1263
|
+
|
|
1264
|
+
|
|
1265
|
+
|
|
1266
|
+
|
|
1267
|
+
|
|
1079
1268
|
* @example
|
|
1080
1269
|
* // Insert at index
|
|
1081
1270
|
* const list = new SinglyLinkedList<number>([1, 3]);
|
|
@@ -1119,6 +1308,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1119
1308
|
|
|
1120
1309
|
|
|
1121
1310
|
|
|
1311
|
+
|
|
1312
|
+
|
|
1313
|
+
|
|
1314
|
+
|
|
1315
|
+
|
|
1316
|
+
|
|
1317
|
+
|
|
1318
|
+
|
|
1319
|
+
|
|
1320
|
+
|
|
1321
|
+
|
|
1322
|
+
|
|
1323
|
+
|
|
1324
|
+
|
|
1325
|
+
|
|
1326
|
+
|
|
1327
|
+
|
|
1328
|
+
|
|
1329
|
+
|
|
1330
|
+
|
|
1331
|
+
|
|
1122
1332
|
* @example
|
|
1123
1333
|
* // Check empty
|
|
1124
1334
|
* console.log(new SinglyLinkedList().isEmpty()); // true;
|
|
@@ -1139,6 +1349,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1139
1349
|
|
|
1140
1350
|
|
|
1141
1351
|
|
|
1352
|
+
|
|
1353
|
+
|
|
1354
|
+
|
|
1355
|
+
|
|
1356
|
+
|
|
1357
|
+
|
|
1358
|
+
|
|
1359
|
+
|
|
1360
|
+
|
|
1361
|
+
|
|
1362
|
+
|
|
1363
|
+
|
|
1364
|
+
|
|
1365
|
+
|
|
1366
|
+
|
|
1367
|
+
|
|
1368
|
+
|
|
1369
|
+
|
|
1370
|
+
|
|
1371
|
+
|
|
1372
|
+
|
|
1142
1373
|
* @example
|
|
1143
1374
|
* // Remove all
|
|
1144
1375
|
* const list = new SinglyLinkedList<number>([1, 2, 3]);
|
|
@@ -1165,6 +1396,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1165
1396
|
|
|
1166
1397
|
|
|
1167
1398
|
|
|
1399
|
+
|
|
1400
|
+
|
|
1401
|
+
|
|
1402
|
+
|
|
1403
|
+
|
|
1404
|
+
|
|
1405
|
+
|
|
1406
|
+
|
|
1407
|
+
|
|
1408
|
+
|
|
1409
|
+
|
|
1410
|
+
|
|
1411
|
+
|
|
1412
|
+
|
|
1413
|
+
|
|
1414
|
+
|
|
1415
|
+
|
|
1416
|
+
|
|
1417
|
+
|
|
1418
|
+
|
|
1419
|
+
|
|
1168
1420
|
* @example
|
|
1169
1421
|
* // Reverse the list in-place
|
|
1170
1422
|
* const list = new SinglyLinkedList<number>([1, 2, 3, 4]);
|
|
@@ -1357,6 +1609,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1357
1609
|
|
|
1358
1610
|
|
|
1359
1611
|
|
|
1612
|
+
|
|
1613
|
+
|
|
1614
|
+
|
|
1615
|
+
|
|
1616
|
+
|
|
1617
|
+
|
|
1618
|
+
|
|
1619
|
+
|
|
1620
|
+
|
|
1621
|
+
|
|
1622
|
+
|
|
1623
|
+
|
|
1624
|
+
|
|
1625
|
+
|
|
1626
|
+
|
|
1627
|
+
|
|
1628
|
+
|
|
1629
|
+
|
|
1630
|
+
|
|
1631
|
+
|
|
1632
|
+
|
|
1360
1633
|
* @example
|
|
1361
1634
|
* // Deep copy
|
|
1362
1635
|
* const list = new SinglyLinkedList<number>([1, 2, 3]);
|
|
@@ -1387,6 +1660,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1387
1660
|
|
|
1388
1661
|
|
|
1389
1662
|
|
|
1663
|
+
|
|
1664
|
+
|
|
1665
|
+
|
|
1666
|
+
|
|
1667
|
+
|
|
1668
|
+
|
|
1669
|
+
|
|
1670
|
+
|
|
1671
|
+
|
|
1672
|
+
|
|
1673
|
+
|
|
1674
|
+
|
|
1675
|
+
|
|
1676
|
+
|
|
1677
|
+
|
|
1678
|
+
|
|
1679
|
+
|
|
1680
|
+
|
|
1681
|
+
|
|
1682
|
+
|
|
1683
|
+
|
|
1390
1684
|
* @example
|
|
1391
1685
|
* // SinglyLinkedList filter and map operations
|
|
1392
1686
|
* const list = new SinglyLinkedList<number>([1, 2, 3, 4, 5]);
|
|
@@ -1445,6 +1739,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1445
1739
|
|
|
1446
1740
|
|
|
1447
1741
|
|
|
1742
|
+
|
|
1743
|
+
|
|
1744
|
+
|
|
1745
|
+
|
|
1746
|
+
|
|
1747
|
+
|
|
1748
|
+
|
|
1749
|
+
|
|
1750
|
+
|
|
1751
|
+
|
|
1752
|
+
|
|
1753
|
+
|
|
1754
|
+
|
|
1755
|
+
|
|
1756
|
+
|
|
1757
|
+
|
|
1758
|
+
|
|
1759
|
+
|
|
1760
|
+
|
|
1761
|
+
|
|
1762
|
+
|
|
1448
1763
|
* @example
|
|
1449
1764
|
* // Transform elements
|
|
1450
1765
|
* const list = new SinglyLinkedList<number>([1, 2, 3]);
|
|
@@ -1705,6 +2020,27 @@ var Queue = class _Queue extends LinearBase {
|
|
|
1705
2020
|
|
|
1706
2021
|
|
|
1707
2022
|
|
|
2023
|
+
|
|
2024
|
+
|
|
2025
|
+
|
|
2026
|
+
|
|
2027
|
+
|
|
2028
|
+
|
|
2029
|
+
|
|
2030
|
+
|
|
2031
|
+
|
|
2032
|
+
|
|
2033
|
+
|
|
2034
|
+
|
|
2035
|
+
|
|
2036
|
+
|
|
2037
|
+
|
|
2038
|
+
|
|
2039
|
+
|
|
2040
|
+
|
|
2041
|
+
|
|
2042
|
+
|
|
2043
|
+
|
|
1708
2044
|
* @example
|
|
1709
2045
|
* // Track queue length
|
|
1710
2046
|
* const q = new Queue<number>();
|
|
@@ -1731,6 +2067,27 @@ var Queue = class _Queue extends LinearBase {
|
|
|
1731
2067
|
|
|
1732
2068
|
|
|
1733
2069
|
|
|
2070
|
+
|
|
2071
|
+
|
|
2072
|
+
|
|
2073
|
+
|
|
2074
|
+
|
|
2075
|
+
|
|
2076
|
+
|
|
2077
|
+
|
|
2078
|
+
|
|
2079
|
+
|
|
2080
|
+
|
|
2081
|
+
|
|
2082
|
+
|
|
2083
|
+
|
|
2084
|
+
|
|
2085
|
+
|
|
2086
|
+
|
|
2087
|
+
|
|
2088
|
+
|
|
2089
|
+
|
|
2090
|
+
|
|
1734
2091
|
* @example
|
|
1735
2092
|
* // View the front element
|
|
1736
2093
|
* const q = new Queue<string>(['first', 'second', 'third']);
|
|
@@ -1773,6 +2130,27 @@ var Queue = class _Queue extends LinearBase {
|
|
|
1773
2130
|
|
|
1774
2131
|
|
|
1775
2132
|
|
|
2133
|
+
|
|
2134
|
+
|
|
2135
|
+
|
|
2136
|
+
|
|
2137
|
+
|
|
2138
|
+
|
|
2139
|
+
|
|
2140
|
+
|
|
2141
|
+
|
|
2142
|
+
|
|
2143
|
+
|
|
2144
|
+
|
|
2145
|
+
|
|
2146
|
+
|
|
2147
|
+
|
|
2148
|
+
|
|
2149
|
+
|
|
2150
|
+
|
|
2151
|
+
|
|
2152
|
+
|
|
2153
|
+
|
|
1776
2154
|
* @example
|
|
1777
2155
|
* // Queue for...of iteration and isEmpty check
|
|
1778
2156
|
* const queue = new Queue<string>(['A', 'B', 'C', 'D']);
|
|
@@ -1811,6 +2189,27 @@ var Queue = class _Queue extends LinearBase {
|
|
|
1811
2189
|
|
|
1812
2190
|
|
|
1813
2191
|
|
|
2192
|
+
|
|
2193
|
+
|
|
2194
|
+
|
|
2195
|
+
|
|
2196
|
+
|
|
2197
|
+
|
|
2198
|
+
|
|
2199
|
+
|
|
2200
|
+
|
|
2201
|
+
|
|
2202
|
+
|
|
2203
|
+
|
|
2204
|
+
|
|
2205
|
+
|
|
2206
|
+
|
|
2207
|
+
|
|
2208
|
+
|
|
2209
|
+
|
|
2210
|
+
|
|
2211
|
+
|
|
2212
|
+
|
|
1814
2213
|
* @example
|
|
1815
2214
|
* // basic Queue creation and push operation
|
|
1816
2215
|
* // Create a simple Queue with initial values
|
|
@@ -1856,6 +2255,27 @@ var Queue = class _Queue extends LinearBase {
|
|
|
1856
2255
|
|
|
1857
2256
|
|
|
1858
2257
|
|
|
2258
|
+
|
|
2259
|
+
|
|
2260
|
+
|
|
2261
|
+
|
|
2262
|
+
|
|
2263
|
+
|
|
2264
|
+
|
|
2265
|
+
|
|
2266
|
+
|
|
2267
|
+
|
|
2268
|
+
|
|
2269
|
+
|
|
2270
|
+
|
|
2271
|
+
|
|
2272
|
+
|
|
2273
|
+
|
|
2274
|
+
|
|
2275
|
+
|
|
2276
|
+
|
|
2277
|
+
|
|
2278
|
+
|
|
1859
2279
|
* @example
|
|
1860
2280
|
* // Queue shift and peek operations
|
|
1861
2281
|
* const queue = new Queue<number>([10, 20, 30, 40]);
|
|
@@ -1891,6 +2311,27 @@ var Queue = class _Queue extends LinearBase {
|
|
|
1891
2311
|
|
|
1892
2312
|
|
|
1893
2313
|
|
|
2314
|
+
|
|
2315
|
+
|
|
2316
|
+
|
|
2317
|
+
|
|
2318
|
+
|
|
2319
|
+
|
|
2320
|
+
|
|
2321
|
+
|
|
2322
|
+
|
|
2323
|
+
|
|
2324
|
+
|
|
2325
|
+
|
|
2326
|
+
|
|
2327
|
+
|
|
2328
|
+
|
|
2329
|
+
|
|
2330
|
+
|
|
2331
|
+
|
|
2332
|
+
|
|
2333
|
+
|
|
2334
|
+
|
|
1894
2335
|
* @example
|
|
1895
2336
|
* // Remove specific element
|
|
1896
2337
|
* const q = new Queue<number>([1, 2, 3, 2]);
|
|
@@ -1919,6 +2360,27 @@ var Queue = class _Queue extends LinearBase {
|
|
|
1919
2360
|
|
|
1920
2361
|
|
|
1921
2362
|
|
|
2363
|
+
|
|
2364
|
+
|
|
2365
|
+
|
|
2366
|
+
|
|
2367
|
+
|
|
2368
|
+
|
|
2369
|
+
|
|
2370
|
+
|
|
2371
|
+
|
|
2372
|
+
|
|
2373
|
+
|
|
2374
|
+
|
|
2375
|
+
|
|
2376
|
+
|
|
2377
|
+
|
|
2378
|
+
|
|
2379
|
+
|
|
2380
|
+
|
|
2381
|
+
|
|
2382
|
+
|
|
2383
|
+
|
|
1922
2384
|
* @example
|
|
1923
2385
|
* // Access element by index
|
|
1924
2386
|
* const q = new Queue<string>(['a', 'b', 'c']);
|
|
@@ -1988,6 +2450,27 @@ var Queue = class _Queue extends LinearBase {
|
|
|
1988
2450
|
|
|
1989
2451
|
|
|
1990
2452
|
|
|
2453
|
+
|
|
2454
|
+
|
|
2455
|
+
|
|
2456
|
+
|
|
2457
|
+
|
|
2458
|
+
|
|
2459
|
+
|
|
2460
|
+
|
|
2461
|
+
|
|
2462
|
+
|
|
2463
|
+
|
|
2464
|
+
|
|
2465
|
+
|
|
2466
|
+
|
|
2467
|
+
|
|
2468
|
+
|
|
2469
|
+
|
|
2470
|
+
|
|
2471
|
+
|
|
2472
|
+
|
|
2473
|
+
|
|
1991
2474
|
* @example
|
|
1992
2475
|
* // Remove all elements
|
|
1993
2476
|
* const q = new Queue<number>([1, 2, 3]);
|
|
@@ -2010,6 +2493,27 @@ var Queue = class _Queue extends LinearBase {
|
|
|
2010
2493
|
|
|
2011
2494
|
|
|
2012
2495
|
|
|
2496
|
+
|
|
2497
|
+
|
|
2498
|
+
|
|
2499
|
+
|
|
2500
|
+
|
|
2501
|
+
|
|
2502
|
+
|
|
2503
|
+
|
|
2504
|
+
|
|
2505
|
+
|
|
2506
|
+
|
|
2507
|
+
|
|
2508
|
+
|
|
2509
|
+
|
|
2510
|
+
|
|
2511
|
+
|
|
2512
|
+
|
|
2513
|
+
|
|
2514
|
+
|
|
2515
|
+
|
|
2516
|
+
|
|
2013
2517
|
* @example
|
|
2014
2518
|
* // Reclaim unused memory
|
|
2015
2519
|
* const q = new Queue<number>([1, 2, 3, 4, 5]);
|
|
@@ -2055,6 +2559,27 @@ var Queue = class _Queue extends LinearBase {
|
|
|
2055
2559
|
|
|
2056
2560
|
|
|
2057
2561
|
|
|
2562
|
+
|
|
2563
|
+
|
|
2564
|
+
|
|
2565
|
+
|
|
2566
|
+
|
|
2567
|
+
|
|
2568
|
+
|
|
2569
|
+
|
|
2570
|
+
|
|
2571
|
+
|
|
2572
|
+
|
|
2573
|
+
|
|
2574
|
+
|
|
2575
|
+
|
|
2576
|
+
|
|
2577
|
+
|
|
2578
|
+
|
|
2579
|
+
|
|
2580
|
+
|
|
2581
|
+
|
|
2582
|
+
|
|
2058
2583
|
* @example
|
|
2059
2584
|
* // Create independent copy
|
|
2060
2585
|
* const q = new Queue<number>([1, 2, 3]);
|
|
@@ -2084,6 +2609,27 @@ var Queue = class _Queue extends LinearBase {
|
|
|
2084
2609
|
|
|
2085
2610
|
|
|
2086
2611
|
|
|
2612
|
+
|
|
2613
|
+
|
|
2614
|
+
|
|
2615
|
+
|
|
2616
|
+
|
|
2617
|
+
|
|
2618
|
+
|
|
2619
|
+
|
|
2620
|
+
|
|
2621
|
+
|
|
2622
|
+
|
|
2623
|
+
|
|
2624
|
+
|
|
2625
|
+
|
|
2626
|
+
|
|
2627
|
+
|
|
2628
|
+
|
|
2629
|
+
|
|
2630
|
+
|
|
2631
|
+
|
|
2632
|
+
|
|
2087
2633
|
* @example
|
|
2088
2634
|
* // Filter elements
|
|
2089
2635
|
* const q = new Queue<number>([1, 2, 3, 4, 5]);
|
|
@@ -2117,6 +2663,27 @@ var Queue = class _Queue extends LinearBase {
|
|
|
2117
2663
|
|
|
2118
2664
|
|
|
2119
2665
|
|
|
2666
|
+
|
|
2667
|
+
|
|
2668
|
+
|
|
2669
|
+
|
|
2670
|
+
|
|
2671
|
+
|
|
2672
|
+
|
|
2673
|
+
|
|
2674
|
+
|
|
2675
|
+
|
|
2676
|
+
|
|
2677
|
+
|
|
2678
|
+
|
|
2679
|
+
|
|
2680
|
+
|
|
2681
|
+
|
|
2682
|
+
|
|
2683
|
+
|
|
2684
|
+
|
|
2685
|
+
|
|
2686
|
+
|
|
2120
2687
|
* @example
|
|
2121
2688
|
* // Transform elements
|
|
2122
2689
|
* const q = new Queue<number>([1, 2, 3]);
|
|
@@ -2371,6 +2938,27 @@ var Deque = class extends LinearBase {
|
|
|
2371
2938
|
|
|
2372
2939
|
|
|
2373
2940
|
|
|
2941
|
+
|
|
2942
|
+
|
|
2943
|
+
|
|
2944
|
+
|
|
2945
|
+
|
|
2946
|
+
|
|
2947
|
+
|
|
2948
|
+
|
|
2949
|
+
|
|
2950
|
+
|
|
2951
|
+
|
|
2952
|
+
|
|
2953
|
+
|
|
2954
|
+
|
|
2955
|
+
|
|
2956
|
+
|
|
2957
|
+
|
|
2958
|
+
|
|
2959
|
+
|
|
2960
|
+
|
|
2961
|
+
|
|
2374
2962
|
* @example
|
|
2375
2963
|
* // Deque peek at both ends
|
|
2376
2964
|
* const deque = new Deque<number>([10, 20, 30, 40, 50]);
|
|
@@ -2405,6 +2993,27 @@ var Deque = class extends LinearBase {
|
|
|
2405
2993
|
|
|
2406
2994
|
|
|
2407
2995
|
|
|
2996
|
+
|
|
2997
|
+
|
|
2998
|
+
|
|
2999
|
+
|
|
3000
|
+
|
|
3001
|
+
|
|
3002
|
+
|
|
3003
|
+
|
|
3004
|
+
|
|
3005
|
+
|
|
3006
|
+
|
|
3007
|
+
|
|
3008
|
+
|
|
3009
|
+
|
|
3010
|
+
|
|
3011
|
+
|
|
3012
|
+
|
|
3013
|
+
|
|
3014
|
+
|
|
3015
|
+
|
|
3016
|
+
|
|
2408
3017
|
* @example
|
|
2409
3018
|
* // Peek at the back element
|
|
2410
3019
|
* const dq = new Deque<string>(['a', 'b', 'c']);
|
|
@@ -2444,6 +3053,27 @@ var Deque = class extends LinearBase {
|
|
|
2444
3053
|
|
|
2445
3054
|
|
|
2446
3055
|
|
|
3056
|
+
|
|
3057
|
+
|
|
3058
|
+
|
|
3059
|
+
|
|
3060
|
+
|
|
3061
|
+
|
|
3062
|
+
|
|
3063
|
+
|
|
3064
|
+
|
|
3065
|
+
|
|
3066
|
+
|
|
3067
|
+
|
|
3068
|
+
|
|
3069
|
+
|
|
3070
|
+
|
|
3071
|
+
|
|
3072
|
+
|
|
3073
|
+
|
|
3074
|
+
|
|
3075
|
+
|
|
3076
|
+
|
|
2447
3077
|
* @example
|
|
2448
3078
|
* // basic Deque creation and push/pop operations
|
|
2449
3079
|
* // Create a simple Deque with initial values
|
|
@@ -2496,6 +3126,27 @@ var Deque = class extends LinearBase {
|
|
|
2496
3126
|
|
|
2497
3127
|
|
|
2498
3128
|
|
|
3129
|
+
|
|
3130
|
+
|
|
3131
|
+
|
|
3132
|
+
|
|
3133
|
+
|
|
3134
|
+
|
|
3135
|
+
|
|
3136
|
+
|
|
3137
|
+
|
|
3138
|
+
|
|
3139
|
+
|
|
3140
|
+
|
|
3141
|
+
|
|
3142
|
+
|
|
3143
|
+
|
|
3144
|
+
|
|
3145
|
+
|
|
3146
|
+
|
|
3147
|
+
|
|
3148
|
+
|
|
3149
|
+
|
|
2499
3150
|
* @example
|
|
2500
3151
|
* // Remove from the back
|
|
2501
3152
|
* const dq = new Deque<number>([1, 2, 3]);
|
|
@@ -2535,6 +3186,27 @@ var Deque = class extends LinearBase {
|
|
|
2535
3186
|
|
|
2536
3187
|
|
|
2537
3188
|
|
|
3189
|
+
|
|
3190
|
+
|
|
3191
|
+
|
|
3192
|
+
|
|
3193
|
+
|
|
3194
|
+
|
|
3195
|
+
|
|
3196
|
+
|
|
3197
|
+
|
|
3198
|
+
|
|
3199
|
+
|
|
3200
|
+
|
|
3201
|
+
|
|
3202
|
+
|
|
3203
|
+
|
|
3204
|
+
|
|
3205
|
+
|
|
3206
|
+
|
|
3207
|
+
|
|
3208
|
+
|
|
3209
|
+
|
|
2538
3210
|
* @example
|
|
2539
3211
|
* // Remove from the front
|
|
2540
3212
|
* const dq = new Deque<number>([1, 2, 3]);
|
|
@@ -2575,6 +3247,27 @@ var Deque = class extends LinearBase {
|
|
|
2575
3247
|
|
|
2576
3248
|
|
|
2577
3249
|
|
|
3250
|
+
|
|
3251
|
+
|
|
3252
|
+
|
|
3253
|
+
|
|
3254
|
+
|
|
3255
|
+
|
|
3256
|
+
|
|
3257
|
+
|
|
3258
|
+
|
|
3259
|
+
|
|
3260
|
+
|
|
3261
|
+
|
|
3262
|
+
|
|
3263
|
+
|
|
3264
|
+
|
|
3265
|
+
|
|
3266
|
+
|
|
3267
|
+
|
|
3268
|
+
|
|
3269
|
+
|
|
3270
|
+
|
|
2578
3271
|
* @example
|
|
2579
3272
|
* // Deque shift and unshift operations
|
|
2580
3273
|
* const deque = new Deque<number>([20, 30, 40]);
|
|
@@ -2656,6 +3349,27 @@ var Deque = class extends LinearBase {
|
|
|
2656
3349
|
|
|
2657
3350
|
|
|
2658
3351
|
|
|
3352
|
+
|
|
3353
|
+
|
|
3354
|
+
|
|
3355
|
+
|
|
3356
|
+
|
|
3357
|
+
|
|
3358
|
+
|
|
3359
|
+
|
|
3360
|
+
|
|
3361
|
+
|
|
3362
|
+
|
|
3363
|
+
|
|
3364
|
+
|
|
3365
|
+
|
|
3366
|
+
|
|
3367
|
+
|
|
3368
|
+
|
|
3369
|
+
|
|
3370
|
+
|
|
3371
|
+
|
|
3372
|
+
|
|
2659
3373
|
* @example
|
|
2660
3374
|
* // Check if empty
|
|
2661
3375
|
* const dq = new Deque();
|
|
@@ -2677,6 +3391,27 @@ var Deque = class extends LinearBase {
|
|
|
2677
3391
|
|
|
2678
3392
|
|
|
2679
3393
|
|
|
3394
|
+
|
|
3395
|
+
|
|
3396
|
+
|
|
3397
|
+
|
|
3398
|
+
|
|
3399
|
+
|
|
3400
|
+
|
|
3401
|
+
|
|
3402
|
+
|
|
3403
|
+
|
|
3404
|
+
|
|
3405
|
+
|
|
3406
|
+
|
|
3407
|
+
|
|
3408
|
+
|
|
3409
|
+
|
|
3410
|
+
|
|
3411
|
+
|
|
3412
|
+
|
|
3413
|
+
|
|
3414
|
+
|
|
2680
3415
|
* @example
|
|
2681
3416
|
* // Remove all elements
|
|
2682
3417
|
* const dq = new Deque<number>([1, 2, 3]);
|
|
@@ -2702,6 +3437,27 @@ var Deque = class extends LinearBase {
|
|
|
2702
3437
|
|
|
2703
3438
|
|
|
2704
3439
|
|
|
3440
|
+
|
|
3441
|
+
|
|
3442
|
+
|
|
3443
|
+
|
|
3444
|
+
|
|
3445
|
+
|
|
3446
|
+
|
|
3447
|
+
|
|
3448
|
+
|
|
3449
|
+
|
|
3450
|
+
|
|
3451
|
+
|
|
3452
|
+
|
|
3453
|
+
|
|
3454
|
+
|
|
3455
|
+
|
|
3456
|
+
|
|
3457
|
+
|
|
3458
|
+
|
|
3459
|
+
|
|
3460
|
+
|
|
2705
3461
|
* @example
|
|
2706
3462
|
* // Access by index
|
|
2707
3463
|
* const dq = new Deque<string>(['a', 'b', 'c']);
|
|
@@ -2878,6 +3634,27 @@ var Deque = class extends LinearBase {
|
|
|
2878
3634
|
|
|
2879
3635
|
|
|
2880
3636
|
|
|
3637
|
+
|
|
3638
|
+
|
|
3639
|
+
|
|
3640
|
+
|
|
3641
|
+
|
|
3642
|
+
|
|
3643
|
+
|
|
3644
|
+
|
|
3645
|
+
|
|
3646
|
+
|
|
3647
|
+
|
|
3648
|
+
|
|
3649
|
+
|
|
3650
|
+
|
|
3651
|
+
|
|
3652
|
+
|
|
3653
|
+
|
|
3654
|
+
|
|
3655
|
+
|
|
3656
|
+
|
|
3657
|
+
|
|
2881
3658
|
* @example
|
|
2882
3659
|
* // Remove element
|
|
2883
3660
|
* const dq = new Deque<number>([1, 2, 3]);
|
|
@@ -2941,6 +3718,27 @@ var Deque = class extends LinearBase {
|
|
|
2941
3718
|
|
|
2942
3719
|
|
|
2943
3720
|
|
|
3721
|
+
|
|
3722
|
+
|
|
3723
|
+
|
|
3724
|
+
|
|
3725
|
+
|
|
3726
|
+
|
|
3727
|
+
|
|
3728
|
+
|
|
3729
|
+
|
|
3730
|
+
|
|
3731
|
+
|
|
3732
|
+
|
|
3733
|
+
|
|
3734
|
+
|
|
3735
|
+
|
|
3736
|
+
|
|
3737
|
+
|
|
3738
|
+
|
|
3739
|
+
|
|
3740
|
+
|
|
3741
|
+
|
|
2944
3742
|
* @example
|
|
2945
3743
|
* // Deque for...of iteration and reverse
|
|
2946
3744
|
* const deque = new Deque<string>(['A', 'B', 'C', 'D']);
|
|
@@ -3029,6 +3827,27 @@ var Deque = class extends LinearBase {
|
|
|
3029
3827
|
|
|
3030
3828
|
|
|
3031
3829
|
|
|
3830
|
+
|
|
3831
|
+
|
|
3832
|
+
|
|
3833
|
+
|
|
3834
|
+
|
|
3835
|
+
|
|
3836
|
+
|
|
3837
|
+
|
|
3838
|
+
|
|
3839
|
+
|
|
3840
|
+
|
|
3841
|
+
|
|
3842
|
+
|
|
3843
|
+
|
|
3844
|
+
|
|
3845
|
+
|
|
3846
|
+
|
|
3847
|
+
|
|
3848
|
+
|
|
3849
|
+
|
|
3850
|
+
|
|
3032
3851
|
* @example
|
|
3033
3852
|
* // Reclaim memory
|
|
3034
3853
|
* const dq = new Deque<number>([1, 2, 3, 4, 5]);
|
|
@@ -3076,6 +3895,27 @@ var Deque = class extends LinearBase {
|
|
|
3076
3895
|
|
|
3077
3896
|
|
|
3078
3897
|
|
|
3898
|
+
|
|
3899
|
+
|
|
3900
|
+
|
|
3901
|
+
|
|
3902
|
+
|
|
3903
|
+
|
|
3904
|
+
|
|
3905
|
+
|
|
3906
|
+
|
|
3907
|
+
|
|
3908
|
+
|
|
3909
|
+
|
|
3910
|
+
|
|
3911
|
+
|
|
3912
|
+
|
|
3913
|
+
|
|
3914
|
+
|
|
3915
|
+
|
|
3916
|
+
|
|
3917
|
+
|
|
3918
|
+
|
|
3079
3919
|
* @example
|
|
3080
3920
|
* // Create independent copy
|
|
3081
3921
|
* const dq = new Deque<number>([1, 2, 3]);
|
|
@@ -3106,6 +3946,27 @@ var Deque = class extends LinearBase {
|
|
|
3106
3946
|
|
|
3107
3947
|
|
|
3108
3948
|
|
|
3949
|
+
|
|
3950
|
+
|
|
3951
|
+
|
|
3952
|
+
|
|
3953
|
+
|
|
3954
|
+
|
|
3955
|
+
|
|
3956
|
+
|
|
3957
|
+
|
|
3958
|
+
|
|
3959
|
+
|
|
3960
|
+
|
|
3961
|
+
|
|
3962
|
+
|
|
3963
|
+
|
|
3964
|
+
|
|
3965
|
+
|
|
3966
|
+
|
|
3967
|
+
|
|
3968
|
+
|
|
3969
|
+
|
|
3109
3970
|
* @example
|
|
3110
3971
|
* // Filter elements
|
|
3111
3972
|
* const dq = new Deque<number>([1, 2, 3, 4]);
|
|
@@ -3156,6 +4017,27 @@ var Deque = class extends LinearBase {
|
|
|
3156
4017
|
|
|
3157
4018
|
|
|
3158
4019
|
|
|
4020
|
+
|
|
4021
|
+
|
|
4022
|
+
|
|
4023
|
+
|
|
4024
|
+
|
|
4025
|
+
|
|
4026
|
+
|
|
4027
|
+
|
|
4028
|
+
|
|
4029
|
+
|
|
4030
|
+
|
|
4031
|
+
|
|
4032
|
+
|
|
4033
|
+
|
|
4034
|
+
|
|
4035
|
+
|
|
4036
|
+
|
|
4037
|
+
|
|
4038
|
+
|
|
4039
|
+
|
|
4040
|
+
|
|
3159
4041
|
* @example
|
|
3160
4042
|
* // Transform elements
|
|
3161
4043
|
* const dq = new Deque<number>([1, 2, 3]);
|