queue-typed 2.5.1 → 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.
Files changed (75) hide show
  1. package/dist/cjs/index.cjs +399 -51
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs-legacy/index.cjs +398 -50
  4. package/dist/cjs-legacy/index.cjs.map +1 -1
  5. package/dist/esm/index.mjs +399 -52
  6. package/dist/esm/index.mjs.map +1 -1
  7. package/dist/esm-legacy/index.mjs +398 -51
  8. package/dist/esm-legacy/index.mjs.map +1 -1
  9. package/dist/types/common/error.d.ts +9 -0
  10. package/dist/types/common/index.d.ts +1 -1
  11. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +86 -2
  12. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +98 -0
  13. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +189 -13
  14. package/dist/types/data-structures/binary-tree/bst.d.ts +270 -3
  15. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +136 -8
  16. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +42 -0
  17. package/dist/types/data-structures/binary-tree/tree-map.d.ts +1089 -161
  18. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +1243 -350
  19. package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +980 -255
  20. package/dist/types/data-structures/binary-tree/tree-set.d.ts +1174 -284
  21. package/dist/types/data-structures/graph/directed-graph.d.ts +70 -0
  22. package/dist/types/data-structures/graph/undirected-graph.d.ts +63 -0
  23. package/dist/types/data-structures/hash/hash-map.d.ts +84 -6
  24. package/dist/types/data-structures/heap/heap.d.ts +140 -12
  25. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +126 -0
  26. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +106 -1
  27. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +126 -0
  28. package/dist/types/data-structures/matrix/matrix.d.ts +56 -0
  29. package/dist/types/data-structures/queue/deque.d.ts +127 -0
  30. package/dist/types/data-structures/queue/queue.d.ts +97 -0
  31. package/dist/types/data-structures/stack/stack.d.ts +72 -2
  32. package/dist/types/data-structures/trie/trie.d.ts +84 -0
  33. package/dist/types/interfaces/binary-tree.d.ts +2 -3
  34. package/dist/types/types/data-structures/binary-tree/bst.d.ts +1 -0
  35. package/dist/types/types/data-structures/binary-tree/tree-map.d.ts +5 -0
  36. package/dist/types/types/data-structures/binary-tree/tree-multi-set.d.ts +4 -0
  37. package/dist/types/types/data-structures/binary-tree/tree-set.d.ts +4 -0
  38. package/dist/umd/queue-typed.js +396 -49
  39. package/dist/umd/queue-typed.js.map +1 -1
  40. package/dist/umd/queue-typed.min.js +1 -1
  41. package/dist/umd/queue-typed.min.js.map +1 -1
  42. package/package.json +2 -2
  43. package/src/common/error.ts +19 -1
  44. package/src/common/index.ts +1 -1
  45. package/src/data-structures/base/iterable-element-base.ts +3 -2
  46. package/src/data-structures/binary-tree/avl-tree.ts +99 -5
  47. package/src/data-structures/binary-tree/binary-indexed-tree.ts +102 -4
  48. package/src/data-structures/binary-tree/binary-tree.ts +239 -78
  49. package/src/data-structures/binary-tree/bst.ts +542 -13
  50. package/src/data-structures/binary-tree/red-black-tree.ts +155 -15
  51. package/src/data-structures/binary-tree/segment-tree.ts +42 -0
  52. package/src/data-structures/binary-tree/tree-map.ts +1223 -261
  53. package/src/data-structures/binary-tree/tree-multi-map.ts +939 -30
  54. package/src/data-structures/binary-tree/tree-multi-set.ts +746 -10
  55. package/src/data-structures/binary-tree/tree-set.ts +1018 -99
  56. package/src/data-structures/graph/abstract-graph.ts +2 -2
  57. package/src/data-structures/graph/directed-graph.ts +71 -1
  58. package/src/data-structures/graph/undirected-graph.ts +64 -1
  59. package/src/data-structures/hash/hash-map.ts +102 -16
  60. package/src/data-structures/heap/heap.ts +153 -23
  61. package/src/data-structures/heap/max-heap.ts +2 -2
  62. package/src/data-structures/linked-list/doubly-linked-list.ts +139 -0
  63. package/src/data-structures/linked-list/singly-linked-list.ts +106 -1
  64. package/src/data-structures/linked-list/skip-linked-list.ts +131 -5
  65. package/src/data-structures/matrix/matrix.ts +65 -9
  66. package/src/data-structures/priority-queue/max-priority-queue.ts +2 -2
  67. package/src/data-structures/queue/deque.ts +130 -0
  68. package/src/data-structures/queue/queue.ts +109 -0
  69. package/src/data-structures/stack/stack.ts +75 -5
  70. package/src/data-structures/trie/trie.ts +86 -2
  71. package/src/interfaces/binary-tree.ts +1 -9
  72. package/src/types/data-structures/binary-tree/bst.ts +1 -0
  73. package/src/types/data-structures/binary-tree/tree-map.ts +6 -0
  74. package/src/types/data-structures/binary-tree/tree-multi-set.ts +5 -0
  75. package/src/types/data-structures/binary-tree/tree-set.ts +5 -0
@@ -3,6 +3,60 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
3
3
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
 
6
+ // src/common/error.ts
7
+ function raise(ErrorClass, message) {
8
+ throw new ErrorClass(message);
9
+ }
10
+ __name(raise, "raise");
11
+ var ERR = {
12
+ // Range / index
13
+ indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
14
+ invalidIndex: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Index must be an integer.`, "invalidIndex"),
15
+ // Type / argument
16
+ invalidArgument: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidArgument"),
17
+ comparatorRequired: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Comparator is required for non-number/non-string/non-Date keys.`, "comparatorRequired"),
18
+ invalidKey: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidKey"),
19
+ notAFunction: /* @__PURE__ */ __name((name, ctx) => `${ctx ? ctx + ": " : ""}${name} must be a function.`, "notAFunction"),
20
+ invalidEntry: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Each entry must be a [key, value] tuple.`, "invalidEntry"),
21
+ invalidNaN: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}NaN is not a valid key.`, "invalidNaN"),
22
+ invalidDate: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Invalid Date key.`, "invalidDate"),
23
+ reduceEmpty: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Reduce of empty structure with no initial value.`, "reduceEmpty"),
24
+ callbackReturnType: /* @__PURE__ */ __name((expected, got, ctx) => `${ctx ? ctx + ": " : ""}Callback must return ${expected}; got ${got}.`, "callbackReturnType"),
25
+ // State / operation
26
+ invalidOperation: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidOperation"),
27
+ // Matrix
28
+ matrixDimensionMismatch: /* @__PURE__ */ __name((op) => `Matrix: Dimensions must be compatible for ${op}.`, "matrixDimensionMismatch"),
29
+ matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
30
+ matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
31
+ matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
32
+ matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch"),
33
+ // Order statistic
34
+ orderStatisticNotEnabled: /* @__PURE__ */ __name((method, ctx) => `${ctx ? ctx + ": " : ""}${method}() requires enableOrderStatistic: true.`, "orderStatisticNotEnabled")
35
+ };
36
+
37
+ // src/common/index.ts
38
+ var DFSOperation = /* @__PURE__ */ ((DFSOperation2) => {
39
+ DFSOperation2[DFSOperation2["VISIT"] = 0] = "VISIT";
40
+ DFSOperation2[DFSOperation2["PROCESS"] = 1] = "PROCESS";
41
+ return DFSOperation2;
42
+ })(DFSOperation || {});
43
+ var _Range = class _Range {
44
+ constructor(low, high, includeLow = true, includeHigh = true) {
45
+ this.low = low;
46
+ this.high = high;
47
+ this.includeLow = includeLow;
48
+ this.includeHigh = includeHigh;
49
+ }
50
+ // Determine whether a key is within the range
51
+ isInRange(key, comparator) {
52
+ const lowCheck = this.includeLow ? comparator(key, this.low) >= 0 : comparator(key, this.low) > 0;
53
+ const highCheck = this.includeHigh ? comparator(key, this.high) <= 0 : comparator(key, this.high) < 0;
54
+ return lowCheck && highCheck;
55
+ }
56
+ };
57
+ __name(_Range, "Range");
58
+ var Range = _Range;
59
+
6
60
  // src/data-structures/base/iterable-element-base.ts
7
61
  var _IterableElementBase = class _IterableElementBase {
8
62
  /**
@@ -25,7 +79,7 @@ var _IterableElementBase = class _IterableElementBase {
25
79
  if (options) {
26
80
  const { toElementFn } = options;
27
81
  if (typeof toElementFn === "function") this._toElementFn = toElementFn;
28
- else if (toElementFn) throw new TypeError("toElementFn must be a function type");
82
+ else if (toElementFn) raise(TypeError, "toElementFn must be a function type");
29
83
  }
30
84
  }
31
85
  /**
@@ -181,7 +235,7 @@ var _IterableElementBase = class _IterableElementBase {
181
235
  acc = initialValue;
182
236
  } else {
183
237
  const first = iter.next();
184
- if (first.done) throw new TypeError("Reduce of empty structure with no initial value");
238
+ if (first.done) raise(TypeError, "Reduce of empty structure with no initial value");
185
239
  acc = first.value;
186
240
  index = 1;
187
241
  }
@@ -747,6 +801,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
747
801
 
748
802
 
749
803
 
804
+
805
+
806
+
807
+
808
+
809
+
810
+
750
811
 
751
812
 
752
813
 
@@ -811,6 +872,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
811
872
 
812
873
 
813
874
 
875
+
876
+
877
+
878
+
879
+
880
+
881
+
814
882
 
815
883
 
816
884
 
@@ -881,6 +949,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
881
949
 
882
950
 
883
951
 
952
+
953
+
954
+
955
+
956
+
957
+
958
+
884
959
 
885
960
 
886
961
 
@@ -932,6 +1007,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
932
1007
 
933
1008
 
934
1009
 
1010
+
1011
+
1012
+
1013
+
1014
+
1015
+
1016
+
935
1017
 
936
1018
 
937
1019
 
@@ -1044,6 +1126,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1044
1126
 
1045
1127
 
1046
1128
 
1129
+
1130
+
1131
+
1132
+
1133
+
1134
+
1135
+
1047
1136
 
1048
1137
 
1049
1138
 
@@ -1100,6 +1189,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1100
1189
 
1101
1190
 
1102
1191
 
1192
+
1193
+
1194
+
1195
+
1196
+
1197
+
1198
+
1103
1199
 
1104
1200
 
1105
1201
 
@@ -1145,6 +1241,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1145
1241
 
1146
1242
 
1147
1243
 
1244
+
1245
+
1246
+
1247
+
1248
+
1249
+
1250
+
1148
1251
 
1149
1252
 
1150
1253
 
@@ -1196,6 +1299,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1196
1299
 
1197
1300
 
1198
1301
 
1302
+
1303
+
1304
+
1305
+
1306
+
1307
+
1308
+
1199
1309
 
1200
1310
 
1201
1311
 
@@ -1252,6 +1362,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1252
1362
 
1253
1363
 
1254
1364
 
1365
+
1366
+
1367
+
1368
+
1369
+
1370
+
1371
+
1255
1372
 
1256
1373
 
1257
1374
 
@@ -1316,6 +1433,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1316
1433
 
1317
1434
 
1318
1435
 
1436
+
1437
+
1438
+
1439
+
1440
+
1441
+
1442
+
1319
1443
 
1320
1444
 
1321
1445
 
@@ -1357,6 +1481,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1357
1481
 
1358
1482
 
1359
1483
 
1484
+
1485
+
1486
+
1487
+
1488
+
1489
+
1490
+
1360
1491
 
1361
1492
 
1362
1493
 
@@ -1404,6 +1535,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1404
1535
 
1405
1536
 
1406
1537
 
1538
+
1539
+
1540
+
1541
+
1542
+
1543
+
1544
+
1407
1545
 
1408
1546
 
1409
1547
 
@@ -1617,6 +1755,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1617
1755
 
1618
1756
 
1619
1757
 
1758
+
1759
+
1760
+
1761
+
1762
+
1763
+
1764
+
1620
1765
 
1621
1766
 
1622
1767
 
@@ -1668,6 +1813,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1668
1813
 
1669
1814
 
1670
1815
 
1816
+
1817
+
1818
+
1819
+
1820
+
1821
+
1822
+
1671
1823
 
1672
1824
 
1673
1825
 
@@ -1747,6 +1899,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1747
1899
 
1748
1900
 
1749
1901
 
1902
+
1903
+
1904
+
1905
+
1906
+
1907
+
1908
+
1750
1909
 
1751
1910
 
1752
1911
 
@@ -1897,54 +2056,6 @@ function elementOrPredicate(input, equals) {
1897
2056
  }
1898
2057
  __name(elementOrPredicate, "elementOrPredicate");
1899
2058
 
1900
- // src/common/error.ts
1901
- var ERR = {
1902
- // Range / index
1903
- indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
1904
- invalidIndex: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Index must be an integer.`, "invalidIndex"),
1905
- // Type / argument
1906
- invalidArgument: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidArgument"),
1907
- comparatorRequired: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Comparator is required for non-number/non-string/non-Date keys.`, "comparatorRequired"),
1908
- invalidKey: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidKey"),
1909
- notAFunction: /* @__PURE__ */ __name((name, ctx) => `${ctx ? ctx + ": " : ""}${name} must be a function.`, "notAFunction"),
1910
- invalidEntry: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Each entry must be a [key, value] tuple.`, "invalidEntry"),
1911
- invalidNaN: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}NaN is not a valid key.`, "invalidNaN"),
1912
- invalidDate: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Invalid Date key.`, "invalidDate"),
1913
- reduceEmpty: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Reduce of empty structure with no initial value.`, "reduceEmpty"),
1914
- callbackReturnType: /* @__PURE__ */ __name((expected, got, ctx) => `${ctx ? ctx + ": " : ""}Callback must return ${expected}; got ${got}.`, "callbackReturnType"),
1915
- // State / operation
1916
- invalidOperation: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidOperation"),
1917
- // Matrix
1918
- matrixDimensionMismatch: /* @__PURE__ */ __name((op) => `Matrix: Dimensions must be compatible for ${op}.`, "matrixDimensionMismatch"),
1919
- matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
1920
- matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
1921
- matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
1922
- matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch")
1923
- };
1924
-
1925
- // src/common/index.ts
1926
- var DFSOperation = /* @__PURE__ */ ((DFSOperation2) => {
1927
- DFSOperation2[DFSOperation2["VISIT"] = 0] = "VISIT";
1928
- DFSOperation2[DFSOperation2["PROCESS"] = 1] = "PROCESS";
1929
- return DFSOperation2;
1930
- })(DFSOperation || {});
1931
- var _Range = class _Range {
1932
- constructor(low, high, includeLow = true, includeHigh = true) {
1933
- this.low = low;
1934
- this.high = high;
1935
- this.includeLow = includeLow;
1936
- this.includeHigh = includeHigh;
1937
- }
1938
- // Determine whether a key is within the range
1939
- isInRange(key, comparator) {
1940
- const lowCheck = this.includeLow ? comparator(key, this.low) >= 0 : comparator(key, this.low) > 0;
1941
- const highCheck = this.includeHigh ? comparator(key, this.high) <= 0 : comparator(key, this.high) < 0;
1942
- return lowCheck && highCheck;
1943
- }
1944
- };
1945
- __name(_Range, "Range");
1946
- var Range = _Range;
1947
-
1948
2059
  // src/data-structures/queue/queue.ts
1949
2060
  var _Queue = class _Queue extends LinearBase {
1950
2061
  /**
@@ -2026,6 +2137,13 @@ var _Queue = class _Queue extends LinearBase {
2026
2137
 
2027
2138
 
2028
2139
 
2140
+
2141
+
2142
+
2143
+
2144
+
2145
+
2146
+
2029
2147
 
2030
2148
 
2031
2149
 
@@ -2073,6 +2191,13 @@ var _Queue = class _Queue extends LinearBase {
2073
2191
 
2074
2192
 
2075
2193
 
2194
+
2195
+
2196
+
2197
+
2198
+
2199
+
2200
+
2076
2201
 
2077
2202
 
2078
2203
 
@@ -2090,6 +2215,14 @@ var _Queue = class _Queue extends LinearBase {
2090
2215
  get first() {
2091
2216
  return this.length > 0 ? this.elements[this._offset] : void 0;
2092
2217
  }
2218
+ /**
2219
+ * Peek at the front element without removing it (alias for `first`).
2220
+ * @remarks Time O(1), Space O(1)
2221
+ * @returns Front element or undefined.
2222
+ */
2223
+ peek() {
2224
+ return this.first;
2225
+ }
2093
2226
  /**
2094
2227
  * Get the last element (back) without removing it.
2095
2228
  * @remarks Time O(1), Space O(1)
@@ -2136,6 +2269,13 @@ var _Queue = class _Queue extends LinearBase {
2136
2269
 
2137
2270
 
2138
2271
 
2272
+
2273
+
2274
+
2275
+
2276
+
2277
+
2278
+
2139
2279
 
2140
2280
 
2141
2281
 
@@ -2195,6 +2335,13 @@ var _Queue = class _Queue extends LinearBase {
2195
2335
 
2196
2336
 
2197
2337
 
2338
+
2339
+
2340
+
2341
+
2342
+
2343
+
2344
+
2198
2345
 
2199
2346
 
2200
2347
 
@@ -2261,6 +2408,13 @@ var _Queue = class _Queue extends LinearBase {
2261
2408
 
2262
2409
 
2263
2410
 
2411
+
2412
+
2413
+
2414
+
2415
+
2416
+
2417
+
2264
2418
 
2265
2419
 
2266
2420
 
@@ -2317,6 +2471,13 @@ var _Queue = class _Queue extends LinearBase {
2317
2471
 
2318
2472
 
2319
2473
 
2474
+
2475
+
2476
+
2477
+
2478
+
2479
+
2480
+
2320
2481
 
2321
2482
 
2322
2483
 
@@ -2366,6 +2527,13 @@ var _Queue = class _Queue extends LinearBase {
2366
2527
 
2367
2528
 
2368
2529
 
2530
+
2531
+
2532
+
2533
+
2534
+
2535
+
2536
+
2369
2537
 
2370
2538
 
2371
2539
 
@@ -2420,6 +2588,21 @@ var _Queue = class _Queue extends LinearBase {
2420
2588
  this._elements[this._offset + index] = newElement;
2421
2589
  return true;
2422
2590
  }
2591
+ /**
2592
+ * Delete the first element that satisfies a predicate.
2593
+ * @remarks Time O(N), Space O(N)
2594
+ * @param predicate - Function (value, index, queue) → boolean to decide deletion.
2595
+ * @returns True if a match was removed.
2596
+ */
2597
+ deleteWhere(predicate) {
2598
+ for (let i = 0; i < this.length; i++) {
2599
+ if (predicate(this._elements[this._offset + i], i, this)) {
2600
+ this.deleteAt(i);
2601
+ return true;
2602
+ }
2603
+ }
2604
+ return false;
2605
+ }
2423
2606
  /**
2424
2607
  * Reverse the queue in-place by compacting then reversing.
2425
2608
  * @remarks Time O(N), Space O(N)
@@ -2456,6 +2639,13 @@ var _Queue = class _Queue extends LinearBase {
2456
2639
 
2457
2640
 
2458
2641
 
2642
+
2643
+
2644
+
2645
+
2646
+
2647
+
2648
+
2459
2649
 
2460
2650
 
2461
2651
 
@@ -2499,6 +2689,13 @@ var _Queue = class _Queue extends LinearBase {
2499
2689
 
2500
2690
 
2501
2691
 
2692
+
2693
+
2694
+
2695
+
2696
+
2697
+
2698
+
2502
2699
 
2503
2700
 
2504
2701
 
@@ -2565,6 +2762,13 @@ var _Queue = class _Queue extends LinearBase {
2565
2762
 
2566
2763
 
2567
2764
 
2765
+
2766
+
2767
+
2768
+
2769
+
2770
+
2771
+
2568
2772
 
2569
2773
 
2570
2774
 
@@ -2615,6 +2819,13 @@ var _Queue = class _Queue extends LinearBase {
2615
2819
 
2616
2820
 
2617
2821
 
2822
+
2823
+
2824
+
2825
+
2826
+
2827
+
2828
+
2618
2829
 
2619
2830
 
2620
2831
 
@@ -2669,6 +2880,13 @@ var _Queue = class _Queue extends LinearBase {
2669
2880
 
2670
2881
 
2671
2882
 
2883
+
2884
+
2885
+
2886
+
2887
+
2888
+
2889
+
2672
2890
 
2673
2891
 
2674
2892
 
@@ -2945,6 +3163,12 @@ var _Deque = class _Deque extends LinearBase {
2945
3163
 
2946
3164
 
2947
3165
 
3166
+
3167
+
3168
+
3169
+
3170
+
3171
+
2948
3172
 
2949
3173
 
2950
3174
 
@@ -2965,6 +3189,31 @@ var _Deque = class _Deque extends LinearBase {
2965
3189
  * console.log(last); // 50;
2966
3190
  *
2967
3191
  * // Length unchanged
3192
+ * console.log(deque.length); // 5;
3193
+ */
3194
+ /**
3195
+ * Peek at the front element without removing it (alias for `first`).
3196
+ * @remarks Time O(1), Space O(1)
3197
+ * @returns Front element or undefined.
3198
+ */
3199
+ peek() {
3200
+ return this.first;
3201
+ }
3202
+ /**
3203
+ * Deque peek at both ends
3204
+ * @example
3205
+ * // Deque peek at both ends
3206
+ * const deque = new Deque<number>([10, 20, 30, 40, 50]);
3207
+ *
3208
+ * // Get first element without removing
3209
+ * const first = deque.at(0);
3210
+ * console.log(first); // 10;
3211
+ *
3212
+ * // Get last element without removing
3213
+ * const last = deque.at(deque.length - 1);
3214
+ * console.log(last); // 50;
3215
+ *
3216
+ * // Length unchanged
2968
3217
  * console.log(deque.length); // 5;
2969
3218
  */
2970
3219
  get first() {
@@ -2999,6 +3248,13 @@ var _Deque = class _Deque extends LinearBase {
2999
3248
 
3000
3249
 
3001
3250
 
3251
+
3252
+
3253
+
3254
+
3255
+
3256
+
3257
+
3002
3258
 
3003
3259
 
3004
3260
 
@@ -3059,6 +3315,13 @@ var _Deque = class _Deque extends LinearBase {
3059
3315
 
3060
3316
 
3061
3317
 
3318
+
3319
+
3320
+
3321
+
3322
+
3323
+
3324
+
3062
3325
 
3063
3326
 
3064
3327
 
@@ -3132,6 +3395,13 @@ var _Deque = class _Deque extends LinearBase {
3132
3395
 
3133
3396
 
3134
3397
 
3398
+
3399
+
3400
+
3401
+
3402
+
3403
+
3404
+
3135
3405
 
3136
3406
 
3137
3407
 
@@ -3192,6 +3462,13 @@ var _Deque = class _Deque extends LinearBase {
3192
3462
 
3193
3463
 
3194
3464
 
3465
+
3466
+
3467
+
3468
+
3469
+
3470
+
3471
+
3195
3472
 
3196
3473
 
3197
3474
 
@@ -3253,6 +3530,13 @@ var _Deque = class _Deque extends LinearBase {
3253
3530
 
3254
3531
 
3255
3532
 
3533
+
3534
+
3535
+
3536
+
3537
+
3538
+
3539
+
3256
3540
 
3257
3541
 
3258
3542
 
@@ -3355,6 +3639,13 @@ var _Deque = class _Deque extends LinearBase {
3355
3639
 
3356
3640
 
3357
3641
 
3642
+
3643
+
3644
+
3645
+
3646
+
3647
+
3648
+
3358
3649
 
3359
3650
 
3360
3651
 
@@ -3397,6 +3688,13 @@ var _Deque = class _Deque extends LinearBase {
3397
3688
 
3398
3689
 
3399
3690
 
3691
+
3692
+
3693
+
3694
+
3695
+
3696
+
3697
+
3400
3698
 
3401
3699
 
3402
3700
 
@@ -3443,6 +3741,13 @@ var _Deque = class _Deque extends LinearBase {
3443
3741
 
3444
3742
 
3445
3743
 
3744
+
3745
+
3746
+
3747
+
3748
+
3749
+
3750
+
3446
3751
 
3447
3752
 
3448
3753
 
@@ -3640,6 +3945,13 @@ var _Deque = class _Deque extends LinearBase {
3640
3945
 
3641
3946
 
3642
3947
 
3948
+
3949
+
3950
+
3951
+
3952
+
3953
+
3954
+
3643
3955
 
3644
3956
 
3645
3957
 
@@ -3724,6 +4036,13 @@ var _Deque = class _Deque extends LinearBase {
3724
4036
 
3725
4037
 
3726
4038
 
4039
+
4040
+
4041
+
4042
+
4043
+
4044
+
4045
+
3727
4046
 
3728
4047
 
3729
4048
 
@@ -3833,6 +4152,13 @@ var _Deque = class _Deque extends LinearBase {
3833
4152
 
3834
4153
 
3835
4154
 
4155
+
4156
+
4157
+
4158
+
4159
+
4160
+
4161
+
3836
4162
 
3837
4163
 
3838
4164
 
@@ -3901,6 +4227,13 @@ var _Deque = class _Deque extends LinearBase {
3901
4227
 
3902
4228
 
3903
4229
 
4230
+
4231
+
4232
+
4233
+
4234
+
4235
+
4236
+
3904
4237
 
3905
4238
 
3906
4239
 
@@ -3952,6 +4285,13 @@ var _Deque = class _Deque extends LinearBase {
3952
4285
 
3953
4286
 
3954
4287
 
4288
+
4289
+
4290
+
4291
+
4292
+
4293
+
4294
+
3955
4295
 
3956
4296
 
3957
4297
 
@@ -4023,6 +4363,13 @@ var _Deque = class _Deque extends LinearBase {
4023
4363
 
4024
4364
 
4025
4365
 
4366
+
4367
+
4368
+
4369
+
4370
+
4371
+
4372
+
4026
4373
 
4027
4374
 
4028
4375
 
@@ -4169,6 +4516,6 @@ var Deque = _Deque;
4169
4516
  * @license MIT License
4170
4517
  */
4171
4518
 
4172
- export { DFSOperation, Deque, ERR, LinkedListQueue, Queue, Range };
4519
+ export { DFSOperation, Deque, ERR, LinkedListQueue, Queue, Range, raise };
4173
4520
  //# sourceMappingURL=index.mjs.map
4174
4521
  //# sourceMappingURL=index.mjs.map