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