linked-list-typed 2.5.0 → 2.5.2
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 +1296 -89
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs-legacy/index.cjs +1296 -89
- package/dist/cjs-legacy/index.cjs.map +1 -1
- package/dist/esm/index.mjs +1296 -90
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm-legacy/index.mjs +1296 -90
- package/dist/esm-legacy/index.mjs.map +1 -1
- package/dist/types/common/error.d.ts +9 -0
- package/dist/types/common/index.d.ts +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 +288 -0
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +336 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +618 -18
- package/dist/types/data-structures/binary-tree/bst.d.ts +676 -1
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +456 -0
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +144 -1
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +3307 -399
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +3285 -360
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +2674 -325
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +3072 -287
- package/dist/types/data-structures/graph/abstract-graph.d.ts +4 -4
- package/dist/types/data-structures/graph/directed-graph.d.ts +240 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +216 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +274 -10
- package/dist/types/data-structures/heap/heap.d.ts +336 -0
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +411 -3
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +363 -3
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +434 -2
- package/dist/types/data-structures/matrix/matrix.d.ts +192 -0
- package/dist/types/data-structures/queue/deque.d.ts +364 -4
- package/dist/types/data-structures/queue/queue.d.ts +288 -0
- package/dist/types/data-structures/stack/stack.d.ts +240 -0
- package/dist/types/data-structures/trie/trie.d.ts +292 -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/binary-tree/bst.d.ts +1 -0
- package/dist/types/types/data-structures/binary-tree/tree-map.d.ts +5 -0
- package/dist/types/types/data-structures/binary-tree/tree-multi-set.d.ts +4 -0
- package/dist/types/types/data-structures/binary-tree/tree-set.d.ts +4 -0
- 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/linked-list-typed.js +1320 -114
- package/dist/umd/linked-list-typed.js.map +1 -1
- package/dist/umd/linked-list-typed.min.js +1 -1
- package/dist/umd/linked-list-typed.min.js.map +1 -1
- package/package.json +2 -2
- package/src/common/error.ts +19 -1
- package/src/common/index.ts +1 -1
- package/src/data-structures/base/index.ts +1 -0
- package/src/data-structures/base/iterable-element-base.ts +3 -2
- 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 +299 -0
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +341 -5
- package/src/data-structures/binary-tree/binary-tree.ts +606 -6
- package/src/data-structures/binary-tree/bst.ts +946 -7
- package/src/data-structures/binary-tree/red-black-tree.ts +472 -0
- package/src/data-structures/binary-tree/segment-tree.ts +145 -2
- package/src/data-structures/binary-tree/tree-map.ts +3423 -499
- package/src/data-structures/binary-tree/tree-multi-map.ts +3537 -596
- package/src/data-structures/binary-tree/tree-multi-set.ts +2855 -495
- package/src/data-structures/binary-tree/tree-set.ts +3209 -413
- package/src/data-structures/graph/abstract-graph.ts +6 -6
- package/src/data-structures/graph/directed-graph.ts +240 -0
- package/src/data-structures/graph/undirected-graph.ts +216 -0
- package/src/data-structures/hash/hash-map.ts +281 -19
- package/src/data-structures/heap/heap.ts +340 -4
- package/src/data-structures/heap/max-heap.ts +2 -2
- package/src/data-structures/linked-list/doubly-linked-list.ts +411 -3
- package/src/data-structures/linked-list/singly-linked-list.ts +363 -3
- package/src/data-structures/linked-list/skip-linked-list.ts +439 -7
- package/src/data-structures/matrix/matrix.ts +202 -10
- package/src/data-structures/priority-queue/max-priority-queue.ts +2 -2
- package/src/data-structures/queue/deque.ts +365 -5
- package/src/data-structures/queue/queue.ts +288 -0
- package/src/data-structures/stack/stack.ts +240 -0
- package/src/data-structures/trie/trie.ts +295 -7
- package/src/interfaces/graph.ts +1 -1
- package/src/types/common.ts +2 -2
- package/src/types/data-structures/binary-tree/bst.ts +1 -0
- package/src/types/data-structures/binary-tree/tree-map.ts +6 -0
- package/src/types/data-structures/binary-tree/tree-multi-set.ts +5 -0
- package/src/types/data-structures/binary-tree/tree-set.ts +5 -0
- 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
|
@@ -1,6 +1,61 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
|
+
// src/common/error.ts
|
|
5
|
+
function raise(ErrorClass, message) {
|
|
6
|
+
throw new ErrorClass(message);
|
|
7
|
+
}
|
|
8
|
+
__name(raise, "raise");
|
|
9
|
+
var ERR = {
|
|
10
|
+
// Range / index
|
|
11
|
+
indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
|
|
12
|
+
invalidIndex: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Index must be an integer.`, "invalidIndex"),
|
|
13
|
+
// Type / argument
|
|
14
|
+
invalidArgument: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidArgument"),
|
|
15
|
+
comparatorRequired: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Comparator is required for non-number/non-string/non-Date keys.`, "comparatorRequired"),
|
|
16
|
+
invalidKey: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidKey"),
|
|
17
|
+
notAFunction: /* @__PURE__ */ __name((name, ctx) => `${ctx ? ctx + ": " : ""}${name} must be a function.`, "notAFunction"),
|
|
18
|
+
invalidEntry: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Each entry must be a [key, value] tuple.`, "invalidEntry"),
|
|
19
|
+
invalidNaN: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}NaN is not a valid key.`, "invalidNaN"),
|
|
20
|
+
invalidDate: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Invalid Date key.`, "invalidDate"),
|
|
21
|
+
reduceEmpty: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Reduce of empty structure with no initial value.`, "reduceEmpty"),
|
|
22
|
+
callbackReturnType: /* @__PURE__ */ __name((expected, got, ctx) => `${ctx ? ctx + ": " : ""}Callback must return ${expected}; got ${got}.`, "callbackReturnType"),
|
|
23
|
+
// State / operation
|
|
24
|
+
invalidOperation: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidOperation"),
|
|
25
|
+
// Matrix
|
|
26
|
+
matrixDimensionMismatch: /* @__PURE__ */ __name((op) => `Matrix: Dimensions must be compatible for ${op}.`, "matrixDimensionMismatch"),
|
|
27
|
+
matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
|
|
28
|
+
matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
|
|
29
|
+
matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
|
|
30
|
+
matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch"),
|
|
31
|
+
// Order statistic
|
|
32
|
+
orderStatisticNotEnabled: /* @__PURE__ */ __name((method, ctx) => `${ctx ? ctx + ": " : ""}${method}() requires enableOrderStatistic: true.`, "orderStatisticNotEnabled")
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// src/common/index.ts
|
|
36
|
+
var DFSOperation = /* @__PURE__ */ ((DFSOperation2) => {
|
|
37
|
+
DFSOperation2[DFSOperation2["VISIT"] = 0] = "VISIT";
|
|
38
|
+
DFSOperation2[DFSOperation2["PROCESS"] = 1] = "PROCESS";
|
|
39
|
+
return DFSOperation2;
|
|
40
|
+
})(DFSOperation || {});
|
|
41
|
+
var Range = class {
|
|
42
|
+
constructor(low, high, includeLow = true, includeHigh = true) {
|
|
43
|
+
this.low = low;
|
|
44
|
+
this.high = high;
|
|
45
|
+
this.includeLow = includeLow;
|
|
46
|
+
this.includeHigh = includeHigh;
|
|
47
|
+
}
|
|
48
|
+
static {
|
|
49
|
+
__name(this, "Range");
|
|
50
|
+
}
|
|
51
|
+
// Determine whether a key is within the range
|
|
52
|
+
isInRange(key, comparator) {
|
|
53
|
+
const lowCheck = this.includeLow ? comparator(key, this.low) >= 0 : comparator(key, this.low) > 0;
|
|
54
|
+
const highCheck = this.includeHigh ? comparator(key, this.high) <= 0 : comparator(key, this.high) < 0;
|
|
55
|
+
return lowCheck && highCheck;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
4
59
|
// src/data-structures/base/iterable-element-base.ts
|
|
5
60
|
var IterableElementBase = class {
|
|
6
61
|
static {
|
|
@@ -19,7 +74,7 @@ var IterableElementBase = class {
|
|
|
19
74
|
if (options) {
|
|
20
75
|
const { toElementFn } = options;
|
|
21
76
|
if (typeof toElementFn === "function") this._toElementFn = toElementFn;
|
|
22
|
-
else if (toElementFn)
|
|
77
|
+
else if (toElementFn) raise(TypeError, "toElementFn must be a function type");
|
|
23
78
|
}
|
|
24
79
|
}
|
|
25
80
|
/**
|
|
@@ -182,7 +237,7 @@ var IterableElementBase = class {
|
|
|
182
237
|
acc = initialValue;
|
|
183
238
|
} else {
|
|
184
239
|
const first = iter.next();
|
|
185
|
-
if (first.done)
|
|
240
|
+
if (first.done) raise(TypeError, "Reduce of empty structure with no initial value");
|
|
186
241
|
acc = first.value;
|
|
187
242
|
index = 1;
|
|
188
243
|
}
|
|
@@ -738,6 +793,30 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
738
793
|
|
|
739
794
|
|
|
740
795
|
|
|
796
|
+
|
|
797
|
+
|
|
798
|
+
|
|
799
|
+
|
|
800
|
+
|
|
801
|
+
|
|
802
|
+
|
|
803
|
+
|
|
804
|
+
|
|
805
|
+
|
|
806
|
+
|
|
807
|
+
|
|
808
|
+
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
|
|
817
|
+
|
|
818
|
+
|
|
819
|
+
|
|
741
820
|
* @example
|
|
742
821
|
* // basic SinglyLinkedList creation and push operation
|
|
743
822
|
* // Create a simple SinglyLinkedList with initial values
|
|
@@ -781,6 +860,30 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
781
860
|
|
|
782
861
|
|
|
783
862
|
|
|
863
|
+
|
|
864
|
+
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
|
|
868
|
+
|
|
869
|
+
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
|
|
874
|
+
|
|
875
|
+
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
|
|
880
|
+
|
|
881
|
+
|
|
882
|
+
|
|
883
|
+
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
|
|
784
887
|
* @example
|
|
785
888
|
* // SinglyLinkedList pop and shift operations
|
|
786
889
|
* const list = new SinglyLinkedList<number>([10, 20, 30, 40, 50]);
|
|
@@ -829,6 +932,30 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
829
932
|
|
|
830
933
|
|
|
831
934
|
|
|
935
|
+
|
|
936
|
+
|
|
937
|
+
|
|
938
|
+
|
|
939
|
+
|
|
940
|
+
|
|
941
|
+
|
|
942
|
+
|
|
943
|
+
|
|
944
|
+
|
|
945
|
+
|
|
946
|
+
|
|
947
|
+
|
|
948
|
+
|
|
949
|
+
|
|
950
|
+
|
|
951
|
+
|
|
952
|
+
|
|
953
|
+
|
|
954
|
+
|
|
955
|
+
|
|
956
|
+
|
|
957
|
+
|
|
958
|
+
|
|
832
959
|
* @example
|
|
833
960
|
* // Remove from the front
|
|
834
961
|
* const list = new SinglyLinkedList<number>([10, 20, 30]);
|
|
@@ -859,6 +986,30 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
859
986
|
|
|
860
987
|
|
|
861
988
|
|
|
989
|
+
|
|
990
|
+
|
|
991
|
+
|
|
992
|
+
|
|
993
|
+
|
|
994
|
+
|
|
995
|
+
|
|
996
|
+
|
|
997
|
+
|
|
998
|
+
|
|
999
|
+
|
|
1000
|
+
|
|
1001
|
+
|
|
1002
|
+
|
|
1003
|
+
|
|
1004
|
+
|
|
1005
|
+
|
|
1006
|
+
|
|
1007
|
+
|
|
1008
|
+
|
|
1009
|
+
|
|
1010
|
+
|
|
1011
|
+
|
|
1012
|
+
|
|
862
1013
|
* @example
|
|
863
1014
|
* // SinglyLinkedList unshift and forward traversal
|
|
864
1015
|
* const list = new SinglyLinkedList<number>([20, 30, 40]);
|
|
@@ -950,6 +1101,30 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
950
1101
|
|
|
951
1102
|
|
|
952
1103
|
|
|
1104
|
+
|
|
1105
|
+
|
|
1106
|
+
|
|
1107
|
+
|
|
1108
|
+
|
|
1109
|
+
|
|
1110
|
+
|
|
1111
|
+
|
|
1112
|
+
|
|
1113
|
+
|
|
1114
|
+
|
|
1115
|
+
|
|
1116
|
+
|
|
1117
|
+
|
|
1118
|
+
|
|
1119
|
+
|
|
1120
|
+
|
|
1121
|
+
|
|
1122
|
+
|
|
1123
|
+
|
|
1124
|
+
|
|
1125
|
+
|
|
1126
|
+
|
|
1127
|
+
|
|
953
1128
|
* @example
|
|
954
1129
|
* // Access element by index
|
|
955
1130
|
* const list = new SinglyLinkedList<string>(['a', 'b', 'c', 'd']);
|
|
@@ -985,6 +1160,30 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
985
1160
|
|
|
986
1161
|
|
|
987
1162
|
|
|
1163
|
+
|
|
1164
|
+
|
|
1165
|
+
|
|
1166
|
+
|
|
1167
|
+
|
|
1168
|
+
|
|
1169
|
+
|
|
1170
|
+
|
|
1171
|
+
|
|
1172
|
+
|
|
1173
|
+
|
|
1174
|
+
|
|
1175
|
+
|
|
1176
|
+
|
|
1177
|
+
|
|
1178
|
+
|
|
1179
|
+
|
|
1180
|
+
|
|
1181
|
+
|
|
1182
|
+
|
|
1183
|
+
|
|
1184
|
+
|
|
1185
|
+
|
|
1186
|
+
|
|
988
1187
|
* @example
|
|
989
1188
|
* // Get node at index
|
|
990
1189
|
* const list = new SinglyLinkedList<string>(['a', 'b', 'c']);
|
|
@@ -1009,6 +1208,30 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1009
1208
|
|
|
1010
1209
|
|
|
1011
1210
|
|
|
1211
|
+
|
|
1212
|
+
|
|
1213
|
+
|
|
1214
|
+
|
|
1215
|
+
|
|
1216
|
+
|
|
1217
|
+
|
|
1218
|
+
|
|
1219
|
+
|
|
1220
|
+
|
|
1221
|
+
|
|
1222
|
+
|
|
1223
|
+
|
|
1224
|
+
|
|
1225
|
+
|
|
1226
|
+
|
|
1227
|
+
|
|
1228
|
+
|
|
1229
|
+
|
|
1230
|
+
|
|
1231
|
+
|
|
1232
|
+
|
|
1233
|
+
|
|
1234
|
+
|
|
1012
1235
|
* @example
|
|
1013
1236
|
* // Remove by index
|
|
1014
1237
|
* const list = new SinglyLinkedList<string>(['a', 'b', 'c']);
|
|
@@ -1039,6 +1262,30 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1039
1262
|
|
|
1040
1263
|
|
|
1041
1264
|
|
|
1265
|
+
|
|
1266
|
+
|
|
1267
|
+
|
|
1268
|
+
|
|
1269
|
+
|
|
1270
|
+
|
|
1271
|
+
|
|
1272
|
+
|
|
1273
|
+
|
|
1274
|
+
|
|
1275
|
+
|
|
1276
|
+
|
|
1277
|
+
|
|
1278
|
+
|
|
1279
|
+
|
|
1280
|
+
|
|
1281
|
+
|
|
1282
|
+
|
|
1283
|
+
|
|
1284
|
+
|
|
1285
|
+
|
|
1286
|
+
|
|
1287
|
+
|
|
1288
|
+
|
|
1042
1289
|
* @example
|
|
1043
1290
|
* // Remove first occurrence
|
|
1044
1291
|
* const list = new SinglyLinkedList<number>([1, 2, 3, 2]);
|
|
@@ -1074,21 +1321,45 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1074
1321
|
|
|
1075
1322
|
|
|
1076
1323
|
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1324
|
+
|
|
1325
|
+
|
|
1326
|
+
|
|
1327
|
+
|
|
1328
|
+
|
|
1329
|
+
|
|
1330
|
+
|
|
1331
|
+
|
|
1332
|
+
|
|
1333
|
+
|
|
1334
|
+
|
|
1335
|
+
|
|
1336
|
+
|
|
1337
|
+
|
|
1338
|
+
|
|
1339
|
+
|
|
1340
|
+
|
|
1341
|
+
|
|
1342
|
+
|
|
1343
|
+
|
|
1344
|
+
|
|
1345
|
+
|
|
1346
|
+
|
|
1347
|
+
|
|
1348
|
+
* @example
|
|
1349
|
+
* // Insert at index
|
|
1350
|
+
* const list = new SinglyLinkedList<number>([1, 3]);
|
|
1351
|
+
* list.addAt(1, 2);
|
|
1352
|
+
* console.log(list.toArray()); // [1, 2, 3];
|
|
1353
|
+
*/
|
|
1354
|
+
addAt(index, newElementOrNode) {
|
|
1355
|
+
if (index < 0 || index > this._length) return false;
|
|
1356
|
+
if (index === 0) return this.unshift(newElementOrNode);
|
|
1357
|
+
if (index === this._length) return this.push(newElementOrNode);
|
|
1358
|
+
const newNode = this._ensureNode(newElementOrNode);
|
|
1359
|
+
const prevNode = this.getNodeAt(index - 1);
|
|
1360
|
+
newNode.next = prevNode.next;
|
|
1361
|
+
prevNode.next = newNode;
|
|
1362
|
+
this._length++;
|
|
1092
1363
|
return true;
|
|
1093
1364
|
}
|
|
1094
1365
|
/**
|
|
@@ -1117,6 +1388,30 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1117
1388
|
|
|
1118
1389
|
|
|
1119
1390
|
|
|
1391
|
+
|
|
1392
|
+
|
|
1393
|
+
|
|
1394
|
+
|
|
1395
|
+
|
|
1396
|
+
|
|
1397
|
+
|
|
1398
|
+
|
|
1399
|
+
|
|
1400
|
+
|
|
1401
|
+
|
|
1402
|
+
|
|
1403
|
+
|
|
1404
|
+
|
|
1405
|
+
|
|
1406
|
+
|
|
1407
|
+
|
|
1408
|
+
|
|
1409
|
+
|
|
1410
|
+
|
|
1411
|
+
|
|
1412
|
+
|
|
1413
|
+
|
|
1414
|
+
|
|
1120
1415
|
* @example
|
|
1121
1416
|
* // Check empty
|
|
1122
1417
|
* console.log(new SinglyLinkedList().isEmpty()); // true;
|
|
@@ -1137,6 +1432,30 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1137
1432
|
|
|
1138
1433
|
|
|
1139
1434
|
|
|
1435
|
+
|
|
1436
|
+
|
|
1437
|
+
|
|
1438
|
+
|
|
1439
|
+
|
|
1440
|
+
|
|
1441
|
+
|
|
1442
|
+
|
|
1443
|
+
|
|
1444
|
+
|
|
1445
|
+
|
|
1446
|
+
|
|
1447
|
+
|
|
1448
|
+
|
|
1449
|
+
|
|
1450
|
+
|
|
1451
|
+
|
|
1452
|
+
|
|
1453
|
+
|
|
1454
|
+
|
|
1455
|
+
|
|
1456
|
+
|
|
1457
|
+
|
|
1458
|
+
|
|
1140
1459
|
* @example
|
|
1141
1460
|
* // Remove all
|
|
1142
1461
|
* const list = new SinglyLinkedList<number>([1, 2, 3]);
|
|
@@ -1163,6 +1482,30 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1163
1482
|
|
|
1164
1483
|
|
|
1165
1484
|
|
|
1485
|
+
|
|
1486
|
+
|
|
1487
|
+
|
|
1488
|
+
|
|
1489
|
+
|
|
1490
|
+
|
|
1491
|
+
|
|
1492
|
+
|
|
1493
|
+
|
|
1494
|
+
|
|
1495
|
+
|
|
1496
|
+
|
|
1497
|
+
|
|
1498
|
+
|
|
1499
|
+
|
|
1500
|
+
|
|
1501
|
+
|
|
1502
|
+
|
|
1503
|
+
|
|
1504
|
+
|
|
1505
|
+
|
|
1506
|
+
|
|
1507
|
+
|
|
1508
|
+
|
|
1166
1509
|
* @example
|
|
1167
1510
|
* // Reverse the list in-place
|
|
1168
1511
|
* const list = new SinglyLinkedList<number>([1, 2, 3, 4]);
|
|
@@ -1355,6 +1698,30 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1355
1698
|
|
|
1356
1699
|
|
|
1357
1700
|
|
|
1701
|
+
|
|
1702
|
+
|
|
1703
|
+
|
|
1704
|
+
|
|
1705
|
+
|
|
1706
|
+
|
|
1707
|
+
|
|
1708
|
+
|
|
1709
|
+
|
|
1710
|
+
|
|
1711
|
+
|
|
1712
|
+
|
|
1713
|
+
|
|
1714
|
+
|
|
1715
|
+
|
|
1716
|
+
|
|
1717
|
+
|
|
1718
|
+
|
|
1719
|
+
|
|
1720
|
+
|
|
1721
|
+
|
|
1722
|
+
|
|
1723
|
+
|
|
1724
|
+
|
|
1358
1725
|
* @example
|
|
1359
1726
|
* // Deep copy
|
|
1360
1727
|
* const list = new SinglyLinkedList<number>([1, 2, 3]);
|
|
@@ -1385,6 +1752,30 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1385
1752
|
|
|
1386
1753
|
|
|
1387
1754
|
|
|
1755
|
+
|
|
1756
|
+
|
|
1757
|
+
|
|
1758
|
+
|
|
1759
|
+
|
|
1760
|
+
|
|
1761
|
+
|
|
1762
|
+
|
|
1763
|
+
|
|
1764
|
+
|
|
1765
|
+
|
|
1766
|
+
|
|
1767
|
+
|
|
1768
|
+
|
|
1769
|
+
|
|
1770
|
+
|
|
1771
|
+
|
|
1772
|
+
|
|
1773
|
+
|
|
1774
|
+
|
|
1775
|
+
|
|
1776
|
+
|
|
1777
|
+
|
|
1778
|
+
|
|
1388
1779
|
* @example
|
|
1389
1780
|
* // SinglyLinkedList filter and map operations
|
|
1390
1781
|
* const list = new SinglyLinkedList<number>([1, 2, 3, 4, 5]);
|
|
@@ -1443,6 +1834,30 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1443
1834
|
|
|
1444
1835
|
|
|
1445
1836
|
|
|
1837
|
+
|
|
1838
|
+
|
|
1839
|
+
|
|
1840
|
+
|
|
1841
|
+
|
|
1842
|
+
|
|
1843
|
+
|
|
1844
|
+
|
|
1845
|
+
|
|
1846
|
+
|
|
1847
|
+
|
|
1848
|
+
|
|
1849
|
+
|
|
1850
|
+
|
|
1851
|
+
|
|
1852
|
+
|
|
1853
|
+
|
|
1854
|
+
|
|
1855
|
+
|
|
1856
|
+
|
|
1857
|
+
|
|
1858
|
+
|
|
1859
|
+
|
|
1860
|
+
|
|
1446
1861
|
* @example
|
|
1447
1862
|
* // Transform elements
|
|
1448
1863
|
* const list = new SinglyLinkedList<number>([1, 2, 3]);
|
|
@@ -1739,6 +2154,30 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
1739
2154
|
|
|
1740
2155
|
|
|
1741
2156
|
|
|
2157
|
+
|
|
2158
|
+
|
|
2159
|
+
|
|
2160
|
+
|
|
2161
|
+
|
|
2162
|
+
|
|
2163
|
+
|
|
2164
|
+
|
|
2165
|
+
|
|
2166
|
+
|
|
2167
|
+
|
|
2168
|
+
|
|
2169
|
+
|
|
2170
|
+
|
|
2171
|
+
|
|
2172
|
+
|
|
2173
|
+
|
|
2174
|
+
|
|
2175
|
+
|
|
2176
|
+
|
|
2177
|
+
|
|
2178
|
+
|
|
2179
|
+
|
|
2180
|
+
|
|
1742
2181
|
* @example
|
|
1743
2182
|
* // basic DoublyLinkedList creation and push operation
|
|
1744
2183
|
* // Create a simple DoublyLinkedList with initial values
|
|
@@ -1784,6 +2223,30 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
1784
2223
|
|
|
1785
2224
|
|
|
1786
2225
|
|
|
2226
|
+
|
|
2227
|
+
|
|
2228
|
+
|
|
2229
|
+
|
|
2230
|
+
|
|
2231
|
+
|
|
2232
|
+
|
|
2233
|
+
|
|
2234
|
+
|
|
2235
|
+
|
|
2236
|
+
|
|
2237
|
+
|
|
2238
|
+
|
|
2239
|
+
|
|
2240
|
+
|
|
2241
|
+
|
|
2242
|
+
|
|
2243
|
+
|
|
2244
|
+
|
|
2245
|
+
|
|
2246
|
+
|
|
2247
|
+
|
|
2248
|
+
|
|
2249
|
+
|
|
1787
2250
|
* @example
|
|
1788
2251
|
* // DoublyLinkedList pop and shift operations
|
|
1789
2252
|
* const list = new DoublyLinkedList<number>([10, 20, 30, 40, 50]);
|
|
@@ -1828,6 +2291,30 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
1828
2291
|
|
|
1829
2292
|
|
|
1830
2293
|
|
|
2294
|
+
|
|
2295
|
+
|
|
2296
|
+
|
|
2297
|
+
|
|
2298
|
+
|
|
2299
|
+
|
|
2300
|
+
|
|
2301
|
+
|
|
2302
|
+
|
|
2303
|
+
|
|
2304
|
+
|
|
2305
|
+
|
|
2306
|
+
|
|
2307
|
+
|
|
2308
|
+
|
|
2309
|
+
|
|
2310
|
+
|
|
2311
|
+
|
|
2312
|
+
|
|
2313
|
+
|
|
2314
|
+
|
|
2315
|
+
|
|
2316
|
+
|
|
2317
|
+
|
|
1831
2318
|
* @example
|
|
1832
2319
|
* // Remove from the front
|
|
1833
2320
|
* const list = new DoublyLinkedList<number>([10, 20, 30]);
|
|
@@ -1863,7 +2350,31 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
1863
2350
|
|
|
1864
2351
|
|
|
1865
2352
|
|
|
1866
|
-
|
|
2353
|
+
|
|
2354
|
+
|
|
2355
|
+
|
|
2356
|
+
|
|
2357
|
+
|
|
2358
|
+
|
|
2359
|
+
|
|
2360
|
+
|
|
2361
|
+
|
|
2362
|
+
|
|
2363
|
+
|
|
2364
|
+
|
|
2365
|
+
|
|
2366
|
+
|
|
2367
|
+
|
|
2368
|
+
|
|
2369
|
+
|
|
2370
|
+
|
|
2371
|
+
|
|
2372
|
+
|
|
2373
|
+
|
|
2374
|
+
|
|
2375
|
+
|
|
2376
|
+
|
|
2377
|
+
* @example
|
|
1867
2378
|
* // Add to the front
|
|
1868
2379
|
* const list = new DoublyLinkedList<number>([2, 3]);
|
|
1869
2380
|
* list.unshift(1);
|
|
@@ -1927,6 +2438,30 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
1927
2438
|
|
|
1928
2439
|
|
|
1929
2440
|
|
|
2441
|
+
|
|
2442
|
+
|
|
2443
|
+
|
|
2444
|
+
|
|
2445
|
+
|
|
2446
|
+
|
|
2447
|
+
|
|
2448
|
+
|
|
2449
|
+
|
|
2450
|
+
|
|
2451
|
+
|
|
2452
|
+
|
|
2453
|
+
|
|
2454
|
+
|
|
2455
|
+
|
|
2456
|
+
|
|
2457
|
+
|
|
2458
|
+
|
|
2459
|
+
|
|
2460
|
+
|
|
2461
|
+
|
|
2462
|
+
|
|
2463
|
+
|
|
2464
|
+
|
|
1930
2465
|
* @example
|
|
1931
2466
|
* // Access by index
|
|
1932
2467
|
* const list = new DoublyLinkedList<string>(['a', 'b', 'c']);
|
|
@@ -1952,6 +2487,30 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
1952
2487
|
|
|
1953
2488
|
|
|
1954
2489
|
|
|
2490
|
+
|
|
2491
|
+
|
|
2492
|
+
|
|
2493
|
+
|
|
2494
|
+
|
|
2495
|
+
|
|
2496
|
+
|
|
2497
|
+
|
|
2498
|
+
|
|
2499
|
+
|
|
2500
|
+
|
|
2501
|
+
|
|
2502
|
+
|
|
2503
|
+
|
|
2504
|
+
|
|
2505
|
+
|
|
2506
|
+
|
|
2507
|
+
|
|
2508
|
+
|
|
2509
|
+
|
|
2510
|
+
|
|
2511
|
+
|
|
2512
|
+
|
|
2513
|
+
|
|
1955
2514
|
* @example
|
|
1956
2515
|
* // Get node at index
|
|
1957
2516
|
* const list = new DoublyLinkedList<string>(['a', 'b', 'c']);
|
|
@@ -2008,6 +2567,30 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
2008
2567
|
|
|
2009
2568
|
|
|
2010
2569
|
|
|
2570
|
+
|
|
2571
|
+
|
|
2572
|
+
|
|
2573
|
+
|
|
2574
|
+
|
|
2575
|
+
|
|
2576
|
+
|
|
2577
|
+
|
|
2578
|
+
|
|
2579
|
+
|
|
2580
|
+
|
|
2581
|
+
|
|
2582
|
+
|
|
2583
|
+
|
|
2584
|
+
|
|
2585
|
+
|
|
2586
|
+
|
|
2587
|
+
|
|
2588
|
+
|
|
2589
|
+
|
|
2590
|
+
|
|
2591
|
+
|
|
2592
|
+
|
|
2593
|
+
|
|
2011
2594
|
* @example
|
|
2012
2595
|
* // Insert at position
|
|
2013
2596
|
* const list = new DoublyLinkedList<number>([1, 3]);
|
|
@@ -2092,6 +2675,30 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
2092
2675
|
|
|
2093
2676
|
|
|
2094
2677
|
|
|
2678
|
+
|
|
2679
|
+
|
|
2680
|
+
|
|
2681
|
+
|
|
2682
|
+
|
|
2683
|
+
|
|
2684
|
+
|
|
2685
|
+
|
|
2686
|
+
|
|
2687
|
+
|
|
2688
|
+
|
|
2689
|
+
|
|
2690
|
+
|
|
2691
|
+
|
|
2692
|
+
|
|
2693
|
+
|
|
2694
|
+
|
|
2695
|
+
|
|
2696
|
+
|
|
2697
|
+
|
|
2698
|
+
|
|
2699
|
+
|
|
2700
|
+
|
|
2701
|
+
|
|
2095
2702
|
* @example
|
|
2096
2703
|
* // Remove by index
|
|
2097
2704
|
* const list = new DoublyLinkedList<string>(['a', 'b', 'c']);
|
|
@@ -2123,6 +2730,30 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
2123
2730
|
|
|
2124
2731
|
|
|
2125
2732
|
|
|
2733
|
+
|
|
2734
|
+
|
|
2735
|
+
|
|
2736
|
+
|
|
2737
|
+
|
|
2738
|
+
|
|
2739
|
+
|
|
2740
|
+
|
|
2741
|
+
|
|
2742
|
+
|
|
2743
|
+
|
|
2744
|
+
|
|
2745
|
+
|
|
2746
|
+
|
|
2747
|
+
|
|
2748
|
+
|
|
2749
|
+
|
|
2750
|
+
|
|
2751
|
+
|
|
2752
|
+
|
|
2753
|
+
|
|
2754
|
+
|
|
2755
|
+
|
|
2756
|
+
|
|
2126
2757
|
* @example
|
|
2127
2758
|
* // Remove first occurrence
|
|
2128
2759
|
* const list = new DoublyLinkedList<number>([1, 2, 3, 2]);
|
|
@@ -2156,6 +2787,30 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
2156
2787
|
|
|
2157
2788
|
|
|
2158
2789
|
|
|
2790
|
+
|
|
2791
|
+
|
|
2792
|
+
|
|
2793
|
+
|
|
2794
|
+
|
|
2795
|
+
|
|
2796
|
+
|
|
2797
|
+
|
|
2798
|
+
|
|
2799
|
+
|
|
2800
|
+
|
|
2801
|
+
|
|
2802
|
+
|
|
2803
|
+
|
|
2804
|
+
|
|
2805
|
+
|
|
2806
|
+
|
|
2807
|
+
|
|
2808
|
+
|
|
2809
|
+
|
|
2810
|
+
|
|
2811
|
+
|
|
2812
|
+
|
|
2813
|
+
|
|
2159
2814
|
* @example
|
|
2160
2815
|
* // Check empty
|
|
2161
2816
|
* console.log(new DoublyLinkedList().isEmpty()); // true;
|
|
@@ -2176,6 +2831,30 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
2176
2831
|
|
|
2177
2832
|
|
|
2178
2833
|
|
|
2834
|
+
|
|
2835
|
+
|
|
2836
|
+
|
|
2837
|
+
|
|
2838
|
+
|
|
2839
|
+
|
|
2840
|
+
|
|
2841
|
+
|
|
2842
|
+
|
|
2843
|
+
|
|
2844
|
+
|
|
2845
|
+
|
|
2846
|
+
|
|
2847
|
+
|
|
2848
|
+
|
|
2849
|
+
|
|
2850
|
+
|
|
2851
|
+
|
|
2852
|
+
|
|
2853
|
+
|
|
2854
|
+
|
|
2855
|
+
|
|
2856
|
+
|
|
2857
|
+
|
|
2179
2858
|
* @example
|
|
2180
2859
|
* // Remove all
|
|
2181
2860
|
* const list = new DoublyLinkedList<number>([1, 2]);
|
|
@@ -2200,6 +2879,30 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
2200
2879
|
|
|
2201
2880
|
|
|
2202
2881
|
|
|
2882
|
+
|
|
2883
|
+
|
|
2884
|
+
|
|
2885
|
+
|
|
2886
|
+
|
|
2887
|
+
|
|
2888
|
+
|
|
2889
|
+
|
|
2890
|
+
|
|
2891
|
+
|
|
2892
|
+
|
|
2893
|
+
|
|
2894
|
+
|
|
2895
|
+
|
|
2896
|
+
|
|
2897
|
+
|
|
2898
|
+
|
|
2899
|
+
|
|
2900
|
+
|
|
2901
|
+
|
|
2902
|
+
|
|
2903
|
+
|
|
2904
|
+
|
|
2905
|
+
|
|
2203
2906
|
* @example
|
|
2204
2907
|
* // Search with predicate
|
|
2205
2908
|
* const list = new DoublyLinkedList<number>([10, 20, 30]);
|
|
@@ -2228,6 +2931,30 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
2228
2931
|
|
|
2229
2932
|
|
|
2230
2933
|
|
|
2934
|
+
|
|
2935
|
+
|
|
2936
|
+
|
|
2937
|
+
|
|
2938
|
+
|
|
2939
|
+
|
|
2940
|
+
|
|
2941
|
+
|
|
2942
|
+
|
|
2943
|
+
|
|
2944
|
+
|
|
2945
|
+
|
|
2946
|
+
|
|
2947
|
+
|
|
2948
|
+
|
|
2949
|
+
|
|
2950
|
+
|
|
2951
|
+
|
|
2952
|
+
|
|
2953
|
+
|
|
2954
|
+
|
|
2955
|
+
|
|
2956
|
+
|
|
2957
|
+
|
|
2231
2958
|
* @example
|
|
2232
2959
|
* // Find value scanning from tail
|
|
2233
2960
|
* const list = new DoublyLinkedList<number>([1, 2, 3, 4]);
|
|
@@ -2259,21 +2986,45 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
2259
2986
|
|
|
2260
2987
|
|
|
2261
2988
|
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2989
|
+
|
|
2990
|
+
|
|
2991
|
+
|
|
2992
|
+
|
|
2993
|
+
|
|
2994
|
+
|
|
2995
|
+
|
|
2996
|
+
|
|
2997
|
+
|
|
2998
|
+
|
|
2999
|
+
|
|
3000
|
+
|
|
3001
|
+
|
|
3002
|
+
|
|
3003
|
+
|
|
3004
|
+
|
|
3005
|
+
|
|
3006
|
+
|
|
3007
|
+
|
|
3008
|
+
|
|
3009
|
+
|
|
3010
|
+
|
|
3011
|
+
|
|
3012
|
+
|
|
3013
|
+
* @example
|
|
3014
|
+
* // Reverse in-place
|
|
3015
|
+
* const list = new DoublyLinkedList<number>([1, 2, 3]);
|
|
3016
|
+
* list.reverse();
|
|
3017
|
+
* console.log([...list]); // [3, 2, 1];
|
|
3018
|
+
*/
|
|
3019
|
+
reverse() {
|
|
3020
|
+
let current = this.head;
|
|
3021
|
+
[this._head, this._tail] = [this.tail, this.head];
|
|
3022
|
+
while (current) {
|
|
3023
|
+
const next = current.next;
|
|
3024
|
+
[current.prev, current.next] = [current.next, current.prev];
|
|
3025
|
+
current = next;
|
|
3026
|
+
}
|
|
3027
|
+
return this;
|
|
2277
3028
|
}
|
|
2278
3029
|
/**
|
|
2279
3030
|
* Set the equality comparator used to compare values.
|
|
@@ -2298,6 +3049,30 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
2298
3049
|
|
|
2299
3050
|
|
|
2300
3051
|
|
|
3052
|
+
|
|
3053
|
+
|
|
3054
|
+
|
|
3055
|
+
|
|
3056
|
+
|
|
3057
|
+
|
|
3058
|
+
|
|
3059
|
+
|
|
3060
|
+
|
|
3061
|
+
|
|
3062
|
+
|
|
3063
|
+
|
|
3064
|
+
|
|
3065
|
+
|
|
3066
|
+
|
|
3067
|
+
|
|
3068
|
+
|
|
3069
|
+
|
|
3070
|
+
|
|
3071
|
+
|
|
3072
|
+
|
|
3073
|
+
|
|
3074
|
+
|
|
3075
|
+
|
|
2301
3076
|
* @example
|
|
2302
3077
|
* // Deep copy
|
|
2303
3078
|
* const list = new DoublyLinkedList<number>([1, 2, 3]);
|
|
@@ -2327,6 +3102,30 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
2327
3102
|
|
|
2328
3103
|
|
|
2329
3104
|
|
|
3105
|
+
|
|
3106
|
+
|
|
3107
|
+
|
|
3108
|
+
|
|
3109
|
+
|
|
3110
|
+
|
|
3111
|
+
|
|
3112
|
+
|
|
3113
|
+
|
|
3114
|
+
|
|
3115
|
+
|
|
3116
|
+
|
|
3117
|
+
|
|
3118
|
+
|
|
3119
|
+
|
|
3120
|
+
|
|
3121
|
+
|
|
3122
|
+
|
|
3123
|
+
|
|
3124
|
+
|
|
3125
|
+
|
|
3126
|
+
|
|
3127
|
+
|
|
3128
|
+
|
|
2330
3129
|
* @example
|
|
2331
3130
|
* // Filter elements
|
|
2332
3131
|
* const list = new DoublyLinkedList<number>([1, 2, 3, 4, 5]);
|
|
@@ -2375,6 +3174,30 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
2375
3174
|
|
|
2376
3175
|
|
|
2377
3176
|
|
|
3177
|
+
|
|
3178
|
+
|
|
3179
|
+
|
|
3180
|
+
|
|
3181
|
+
|
|
3182
|
+
|
|
3183
|
+
|
|
3184
|
+
|
|
3185
|
+
|
|
3186
|
+
|
|
3187
|
+
|
|
3188
|
+
|
|
3189
|
+
|
|
3190
|
+
|
|
3191
|
+
|
|
3192
|
+
|
|
3193
|
+
|
|
3194
|
+
|
|
3195
|
+
|
|
3196
|
+
|
|
3197
|
+
|
|
3198
|
+
|
|
3199
|
+
|
|
3200
|
+
|
|
2378
3201
|
* @example
|
|
2379
3202
|
* // DoublyLinkedList for...of iteration and map operation
|
|
2380
3203
|
* const list = new DoublyLinkedList<number>([1, 2, 3, 4, 5]);
|
|
@@ -2478,55 +3301,6 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
2478
3301
|
}
|
|
2479
3302
|
};
|
|
2480
3303
|
|
|
2481
|
-
// src/common/error.ts
|
|
2482
|
-
var ERR = {
|
|
2483
|
-
// Range / index
|
|
2484
|
-
indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
|
|
2485
|
-
invalidIndex: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Index must be an integer.`, "invalidIndex"),
|
|
2486
|
-
// Type / argument
|
|
2487
|
-
invalidArgument: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidArgument"),
|
|
2488
|
-
comparatorRequired: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Comparator is required for non-number/non-string/non-Date keys.`, "comparatorRequired"),
|
|
2489
|
-
invalidKey: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidKey"),
|
|
2490
|
-
notAFunction: /* @__PURE__ */ __name((name, ctx) => `${ctx ? ctx + ": " : ""}${name} must be a function.`, "notAFunction"),
|
|
2491
|
-
invalidEntry: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Each entry must be a [key, value] tuple.`, "invalidEntry"),
|
|
2492
|
-
invalidNaN: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}NaN is not a valid key.`, "invalidNaN"),
|
|
2493
|
-
invalidDate: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Invalid Date key.`, "invalidDate"),
|
|
2494
|
-
reduceEmpty: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Reduce of empty structure with no initial value.`, "reduceEmpty"),
|
|
2495
|
-
callbackReturnType: /* @__PURE__ */ __name((expected, got, ctx) => `${ctx ? ctx + ": " : ""}Callback must return ${expected}; got ${got}.`, "callbackReturnType"),
|
|
2496
|
-
// State / operation
|
|
2497
|
-
invalidOperation: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidOperation"),
|
|
2498
|
-
// Matrix
|
|
2499
|
-
matrixDimensionMismatch: /* @__PURE__ */ __name((op) => `Matrix: Dimensions must be compatible for ${op}.`, "matrixDimensionMismatch"),
|
|
2500
|
-
matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
|
|
2501
|
-
matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
|
|
2502
|
-
matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
|
|
2503
|
-
matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch")
|
|
2504
|
-
};
|
|
2505
|
-
|
|
2506
|
-
// src/common/index.ts
|
|
2507
|
-
var DFSOperation = /* @__PURE__ */ ((DFSOperation2) => {
|
|
2508
|
-
DFSOperation2[DFSOperation2["VISIT"] = 0] = "VISIT";
|
|
2509
|
-
DFSOperation2[DFSOperation2["PROCESS"] = 1] = "PROCESS";
|
|
2510
|
-
return DFSOperation2;
|
|
2511
|
-
})(DFSOperation || {});
|
|
2512
|
-
var Range = class {
|
|
2513
|
-
constructor(low, high, includeLow = true, includeHigh = true) {
|
|
2514
|
-
this.low = low;
|
|
2515
|
-
this.high = high;
|
|
2516
|
-
this.includeLow = includeLow;
|
|
2517
|
-
this.includeHigh = includeHigh;
|
|
2518
|
-
}
|
|
2519
|
-
static {
|
|
2520
|
-
__name(this, "Range");
|
|
2521
|
-
}
|
|
2522
|
-
// Determine whether a key is within the range
|
|
2523
|
-
isInRange(key, comparator) {
|
|
2524
|
-
const lowCheck = this.includeLow ? comparator(key, this.low) >= 0 : comparator(key, this.low) > 0;
|
|
2525
|
-
const highCheck = this.includeHigh ? comparator(key, this.high) <= 0 : comparator(key, this.high) < 0;
|
|
2526
|
-
return lowCheck && highCheck;
|
|
2527
|
-
}
|
|
2528
|
-
};
|
|
2529
|
-
|
|
2530
3304
|
// src/data-structures/base/iterable-entry-base.ts
|
|
2531
3305
|
var IterableEntryBase = class {
|
|
2532
3306
|
static {
|
|
@@ -2744,7 +3518,7 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
2744
3518
|
[k, v] = toEntryFn(item);
|
|
2745
3519
|
} else {
|
|
2746
3520
|
if (!Array.isArray(item) || item.length < 2) {
|
|
2747
|
-
|
|
3521
|
+
raise(TypeError, ERR.invalidEntry("SkipList"));
|
|
2748
3522
|
}
|
|
2749
3523
|
[k, v] = item;
|
|
2750
3524
|
}
|
|
@@ -2757,7 +3531,7 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
2757
3531
|
static createDefaultComparator() {
|
|
2758
3532
|
return (a, b) => {
|
|
2759
3533
|
if (typeof a === "number" && typeof b === "number") {
|
|
2760
|
-
if (Number.isNaN(a) || Number.isNaN(b))
|
|
3534
|
+
if (Number.isNaN(a) || Number.isNaN(b)) raise(TypeError, ERR.invalidNaN("SkipList"));
|
|
2761
3535
|
return a - b;
|
|
2762
3536
|
}
|
|
2763
3537
|
if (typeof a === "string" && typeof b === "string") {
|
|
@@ -2765,13 +3539,13 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
2765
3539
|
}
|
|
2766
3540
|
if (a instanceof Date && b instanceof Date) {
|
|
2767
3541
|
const ta = a.getTime(), tb = b.getTime();
|
|
2768
|
-
if (Number.isNaN(ta) || Number.isNaN(tb))
|
|
3542
|
+
if (Number.isNaN(ta) || Number.isNaN(tb)) raise(TypeError, ERR.invalidDate("SkipList"));
|
|
2769
3543
|
return ta - tb;
|
|
2770
3544
|
}
|
|
2771
3545
|
if (typeof a === "bigint" && typeof b === "bigint") {
|
|
2772
3546
|
return a < b ? -1 : a > b ? 1 : 0;
|
|
2773
3547
|
}
|
|
2774
|
-
|
|
3548
|
+
raise(TypeError, ERR.comparatorRequired("SkipList"));
|
|
2775
3549
|
};
|
|
2776
3550
|
}
|
|
2777
3551
|
// ─── Internal state ──────────────────────────────────────────
|
|
@@ -2803,6 +3577,30 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
2803
3577
|
|
|
2804
3578
|
|
|
2805
3579
|
|
|
3580
|
+
|
|
3581
|
+
|
|
3582
|
+
|
|
3583
|
+
|
|
3584
|
+
|
|
3585
|
+
|
|
3586
|
+
|
|
3587
|
+
|
|
3588
|
+
|
|
3589
|
+
|
|
3590
|
+
|
|
3591
|
+
|
|
3592
|
+
|
|
3593
|
+
|
|
3594
|
+
|
|
3595
|
+
|
|
3596
|
+
|
|
3597
|
+
|
|
3598
|
+
|
|
3599
|
+
|
|
3600
|
+
|
|
3601
|
+
|
|
3602
|
+
|
|
3603
|
+
|
|
2806
3604
|
* @example
|
|
2807
3605
|
* // Check if empty
|
|
2808
3606
|
* const sl = new SkipList<number, string>();
|
|
@@ -2821,6 +3619,30 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
2821
3619
|
|
|
2822
3620
|
|
|
2823
3621
|
|
|
3622
|
+
|
|
3623
|
+
|
|
3624
|
+
|
|
3625
|
+
|
|
3626
|
+
|
|
3627
|
+
|
|
3628
|
+
|
|
3629
|
+
|
|
3630
|
+
|
|
3631
|
+
|
|
3632
|
+
|
|
3633
|
+
|
|
3634
|
+
|
|
3635
|
+
|
|
3636
|
+
|
|
3637
|
+
|
|
3638
|
+
|
|
3639
|
+
|
|
3640
|
+
|
|
3641
|
+
|
|
3642
|
+
|
|
3643
|
+
|
|
3644
|
+
|
|
3645
|
+
|
|
2824
3646
|
* @example
|
|
2825
3647
|
* // Remove all entries
|
|
2826
3648
|
* const sl = new SkipList<number, string>([[1, 'a'], [2, 'b']]);
|
|
@@ -2842,6 +3664,30 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
2842
3664
|
|
|
2843
3665
|
|
|
2844
3666
|
|
|
3667
|
+
|
|
3668
|
+
|
|
3669
|
+
|
|
3670
|
+
|
|
3671
|
+
|
|
3672
|
+
|
|
3673
|
+
|
|
3674
|
+
|
|
3675
|
+
|
|
3676
|
+
|
|
3677
|
+
|
|
3678
|
+
|
|
3679
|
+
|
|
3680
|
+
|
|
3681
|
+
|
|
3682
|
+
|
|
3683
|
+
|
|
3684
|
+
|
|
3685
|
+
|
|
3686
|
+
|
|
3687
|
+
|
|
3688
|
+
|
|
3689
|
+
|
|
3690
|
+
|
|
2845
3691
|
* @example
|
|
2846
3692
|
* // Create independent copy
|
|
2847
3693
|
* const sl = new SkipList<number, string>([[1, 'a'], [2, 'b']]);
|
|
@@ -2871,6 +3717,30 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
2871
3717
|
|
|
2872
3718
|
|
|
2873
3719
|
|
|
3720
|
+
|
|
3721
|
+
|
|
3722
|
+
|
|
3723
|
+
|
|
3724
|
+
|
|
3725
|
+
|
|
3726
|
+
|
|
3727
|
+
|
|
3728
|
+
|
|
3729
|
+
|
|
3730
|
+
|
|
3731
|
+
|
|
3732
|
+
|
|
3733
|
+
|
|
3734
|
+
|
|
3735
|
+
|
|
3736
|
+
|
|
3737
|
+
|
|
3738
|
+
|
|
3739
|
+
|
|
3740
|
+
|
|
3741
|
+
|
|
3742
|
+
|
|
3743
|
+
|
|
2874
3744
|
* @example
|
|
2875
3745
|
* // In-memory sorted key-value store
|
|
2876
3746
|
* const store = new SkipList<number, string>();
|
|
@@ -2925,7 +3795,31 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
2925
3795
|
|
|
2926
3796
|
|
|
2927
3797
|
|
|
2928
|
-
|
|
3798
|
+
|
|
3799
|
+
|
|
3800
|
+
|
|
3801
|
+
|
|
3802
|
+
|
|
3803
|
+
|
|
3804
|
+
|
|
3805
|
+
|
|
3806
|
+
|
|
3807
|
+
|
|
3808
|
+
|
|
3809
|
+
|
|
3810
|
+
|
|
3811
|
+
|
|
3812
|
+
|
|
3813
|
+
|
|
3814
|
+
|
|
3815
|
+
|
|
3816
|
+
|
|
3817
|
+
|
|
3818
|
+
|
|
3819
|
+
|
|
3820
|
+
|
|
3821
|
+
|
|
3822
|
+
* @example
|
|
2929
3823
|
* // Building a sorted index
|
|
2930
3824
|
* type Product = { id: number; name: string; price: number };
|
|
2931
3825
|
* const products: Product[] = [
|
|
@@ -2934,8 +3828,8 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
2934
3828
|
* { id: 3, name: 'Doohickey', price: 15 }
|
|
2935
3829
|
* ];
|
|
2936
3830
|
*
|
|
2937
|
-
* const index = new SkipList<number, Product>(products
|
|
2938
|
-
* toEntryFn: (p:
|
|
3831
|
+
* const index = new SkipList<number, Product, Product>(products, {
|
|
3832
|
+
* toEntryFn: (p: Product) => [p.price, p]
|
|
2939
3833
|
* });
|
|
2940
3834
|
*
|
|
2941
3835
|
* // Iterate in sorted order by price
|
|
@@ -2964,6 +3858,30 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
2964
3858
|
|
|
2965
3859
|
|
|
2966
3860
|
|
|
3861
|
+
|
|
3862
|
+
|
|
3863
|
+
|
|
3864
|
+
|
|
3865
|
+
|
|
3866
|
+
|
|
3867
|
+
|
|
3868
|
+
|
|
3869
|
+
|
|
3870
|
+
|
|
3871
|
+
|
|
3872
|
+
|
|
3873
|
+
|
|
3874
|
+
|
|
3875
|
+
|
|
3876
|
+
|
|
3877
|
+
|
|
3878
|
+
|
|
3879
|
+
|
|
3880
|
+
|
|
3881
|
+
|
|
3882
|
+
|
|
3883
|
+
|
|
3884
|
+
|
|
2967
3885
|
* @example
|
|
2968
3886
|
* // Check key existence
|
|
2969
3887
|
* const sl = new SkipList<number, string>([[1, 'a'], [3, 'c'], [5, 'e']]);
|
|
@@ -2986,6 +3904,30 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
2986
3904
|
|
|
2987
3905
|
|
|
2988
3906
|
|
|
3907
|
+
|
|
3908
|
+
|
|
3909
|
+
|
|
3910
|
+
|
|
3911
|
+
|
|
3912
|
+
|
|
3913
|
+
|
|
3914
|
+
|
|
3915
|
+
|
|
3916
|
+
|
|
3917
|
+
|
|
3918
|
+
|
|
3919
|
+
|
|
3920
|
+
|
|
3921
|
+
|
|
3922
|
+
|
|
3923
|
+
|
|
3924
|
+
|
|
3925
|
+
|
|
3926
|
+
|
|
3927
|
+
|
|
3928
|
+
|
|
3929
|
+
|
|
3930
|
+
|
|
2989
3931
|
* @example
|
|
2990
3932
|
* // Fast lookup with deletion
|
|
2991
3933
|
* const cache = new SkipList<string, number>();
|
|
@@ -3028,6 +3970,30 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
3028
3970
|
|
|
3029
3971
|
|
|
3030
3972
|
|
|
3973
|
+
|
|
3974
|
+
|
|
3975
|
+
|
|
3976
|
+
|
|
3977
|
+
|
|
3978
|
+
|
|
3979
|
+
|
|
3980
|
+
|
|
3981
|
+
|
|
3982
|
+
|
|
3983
|
+
|
|
3984
|
+
|
|
3985
|
+
|
|
3986
|
+
|
|
3987
|
+
|
|
3988
|
+
|
|
3989
|
+
|
|
3990
|
+
|
|
3991
|
+
|
|
3992
|
+
|
|
3993
|
+
|
|
3994
|
+
|
|
3995
|
+
|
|
3996
|
+
|
|
3031
3997
|
* @example
|
|
3032
3998
|
* // Access the minimum entry
|
|
3033
3999
|
* const sl = new SkipList<number, string>([[5, 'e'], [1, 'a'], [3, 'c']]);
|
|
@@ -3050,6 +4016,30 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
3050
4016
|
|
|
3051
4017
|
|
|
3052
4018
|
|
|
4019
|
+
|
|
4020
|
+
|
|
4021
|
+
|
|
4022
|
+
|
|
4023
|
+
|
|
4024
|
+
|
|
4025
|
+
|
|
4026
|
+
|
|
4027
|
+
|
|
4028
|
+
|
|
4029
|
+
|
|
4030
|
+
|
|
4031
|
+
|
|
4032
|
+
|
|
4033
|
+
|
|
4034
|
+
|
|
4035
|
+
|
|
4036
|
+
|
|
4037
|
+
|
|
4038
|
+
|
|
4039
|
+
|
|
4040
|
+
|
|
4041
|
+
|
|
4042
|
+
|
|
3053
4043
|
* @example
|
|
3054
4044
|
* // Access the maximum entry
|
|
3055
4045
|
* const sl = new SkipList<number, string>([[5, 'e'], [1, 'a'], [3, 'c']]);
|
|
@@ -3074,6 +4064,30 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
3074
4064
|
|
|
3075
4065
|
|
|
3076
4066
|
|
|
4067
|
+
|
|
4068
|
+
|
|
4069
|
+
|
|
4070
|
+
|
|
4071
|
+
|
|
4072
|
+
|
|
4073
|
+
|
|
4074
|
+
|
|
4075
|
+
|
|
4076
|
+
|
|
4077
|
+
|
|
4078
|
+
|
|
4079
|
+
|
|
4080
|
+
|
|
4081
|
+
|
|
4082
|
+
|
|
4083
|
+
|
|
4084
|
+
|
|
4085
|
+
|
|
4086
|
+
|
|
4087
|
+
|
|
4088
|
+
|
|
4089
|
+
|
|
4090
|
+
|
|
3077
4091
|
* @example
|
|
3078
4092
|
* // Remove and return smallest
|
|
3079
4093
|
* const sl = new SkipList<number, string>([[1, 'a'], [2, 'b'], [3, 'c']]);
|
|
@@ -3096,6 +4110,30 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
3096
4110
|
|
|
3097
4111
|
|
|
3098
4112
|
|
|
4113
|
+
|
|
4114
|
+
|
|
4115
|
+
|
|
4116
|
+
|
|
4117
|
+
|
|
4118
|
+
|
|
4119
|
+
|
|
4120
|
+
|
|
4121
|
+
|
|
4122
|
+
|
|
4123
|
+
|
|
4124
|
+
|
|
4125
|
+
|
|
4126
|
+
|
|
4127
|
+
|
|
4128
|
+
|
|
4129
|
+
|
|
4130
|
+
|
|
4131
|
+
|
|
4132
|
+
|
|
4133
|
+
|
|
4134
|
+
|
|
4135
|
+
|
|
4136
|
+
|
|
3099
4137
|
* @example
|
|
3100
4138
|
* // Remove and return largest
|
|
3101
4139
|
* const sl = new SkipList<number, string>([[1, 'a'], [2, 'b'], [3, 'c']]);
|
|
@@ -3121,6 +4159,30 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
3121
4159
|
|
|
3122
4160
|
|
|
3123
4161
|
|
|
4162
|
+
|
|
4163
|
+
|
|
4164
|
+
|
|
4165
|
+
|
|
4166
|
+
|
|
4167
|
+
|
|
4168
|
+
|
|
4169
|
+
|
|
4170
|
+
|
|
4171
|
+
|
|
4172
|
+
|
|
4173
|
+
|
|
4174
|
+
|
|
4175
|
+
|
|
4176
|
+
|
|
4177
|
+
|
|
4178
|
+
|
|
4179
|
+
|
|
4180
|
+
|
|
4181
|
+
|
|
4182
|
+
|
|
4183
|
+
|
|
4184
|
+
|
|
4185
|
+
|
|
3124
4186
|
* @example
|
|
3125
4187
|
* // Least entry ≥ key
|
|
3126
4188
|
* const sl = new SkipList<number, string>([[10, 'a'], [20, 'b'], [30, 'c']]);
|
|
@@ -3151,6 +4213,30 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
3151
4213
|
|
|
3152
4214
|
|
|
3153
4215
|
|
|
4216
|
+
|
|
4217
|
+
|
|
4218
|
+
|
|
4219
|
+
|
|
4220
|
+
|
|
4221
|
+
|
|
4222
|
+
|
|
4223
|
+
|
|
4224
|
+
|
|
4225
|
+
|
|
4226
|
+
|
|
4227
|
+
|
|
4228
|
+
|
|
4229
|
+
|
|
4230
|
+
|
|
4231
|
+
|
|
4232
|
+
|
|
4233
|
+
|
|
4234
|
+
|
|
4235
|
+
|
|
4236
|
+
|
|
4237
|
+
|
|
4238
|
+
|
|
4239
|
+
|
|
3154
4240
|
* @example
|
|
3155
4241
|
* // Greatest entry ≤ key
|
|
3156
4242
|
* const sl = new SkipList<number, string>([[10, 'a'], [20, 'b'], [30, 'c']]);
|
|
@@ -3179,6 +4265,30 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
3179
4265
|
|
|
3180
4266
|
|
|
3181
4267
|
|
|
4268
|
+
|
|
4269
|
+
|
|
4270
|
+
|
|
4271
|
+
|
|
4272
|
+
|
|
4273
|
+
|
|
4274
|
+
|
|
4275
|
+
|
|
4276
|
+
|
|
4277
|
+
|
|
4278
|
+
|
|
4279
|
+
|
|
4280
|
+
|
|
4281
|
+
|
|
4282
|
+
|
|
4283
|
+
|
|
4284
|
+
|
|
4285
|
+
|
|
4286
|
+
|
|
4287
|
+
|
|
4288
|
+
|
|
4289
|
+
|
|
4290
|
+
|
|
4291
|
+
|
|
3182
4292
|
* @example
|
|
3183
4293
|
* // Strictly greater entry
|
|
3184
4294
|
* const sl = new SkipList<number, string>([[10, 'a'], [20, 'b'], [30, 'c']]);
|
|
@@ -3206,6 +4316,30 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
3206
4316
|
|
|
3207
4317
|
|
|
3208
4318
|
|
|
4319
|
+
|
|
4320
|
+
|
|
4321
|
+
|
|
4322
|
+
|
|
4323
|
+
|
|
4324
|
+
|
|
4325
|
+
|
|
4326
|
+
|
|
4327
|
+
|
|
4328
|
+
|
|
4329
|
+
|
|
4330
|
+
|
|
4331
|
+
|
|
4332
|
+
|
|
4333
|
+
|
|
4334
|
+
|
|
4335
|
+
|
|
4336
|
+
|
|
4337
|
+
|
|
4338
|
+
|
|
4339
|
+
|
|
4340
|
+
|
|
4341
|
+
|
|
4342
|
+
|
|
3209
4343
|
* @example
|
|
3210
4344
|
* // Strictly less entry
|
|
3211
4345
|
* const sl = new SkipList<number, string>([[10, 'a'], [20, 'b'], [30, 'c']]);
|
|
@@ -3239,6 +4373,30 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
3239
4373
|
|
|
3240
4374
|
|
|
3241
4375
|
|
|
4376
|
+
|
|
4377
|
+
|
|
4378
|
+
|
|
4379
|
+
|
|
4380
|
+
|
|
4381
|
+
|
|
4382
|
+
|
|
4383
|
+
|
|
4384
|
+
|
|
4385
|
+
|
|
4386
|
+
|
|
4387
|
+
|
|
4388
|
+
|
|
4389
|
+
|
|
4390
|
+
|
|
4391
|
+
|
|
4392
|
+
|
|
4393
|
+
|
|
4394
|
+
|
|
4395
|
+
|
|
4396
|
+
|
|
4397
|
+
|
|
4398
|
+
|
|
4399
|
+
|
|
3242
4400
|
* @example
|
|
3243
4401
|
* // Find entries in a range
|
|
3244
4402
|
* const sl = new SkipList<number, string>([[1, 'a'], [2, 'b'], [3, 'c'], [4, 'd'], [5, 'e']]);
|
|
@@ -3280,6 +4438,30 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
3280
4438
|
|
|
3281
4439
|
|
|
3282
4440
|
|
|
4441
|
+
|
|
4442
|
+
|
|
4443
|
+
|
|
4444
|
+
|
|
4445
|
+
|
|
4446
|
+
|
|
4447
|
+
|
|
4448
|
+
|
|
4449
|
+
|
|
4450
|
+
|
|
4451
|
+
|
|
4452
|
+
|
|
4453
|
+
|
|
4454
|
+
|
|
4455
|
+
|
|
4456
|
+
|
|
4457
|
+
|
|
4458
|
+
|
|
4459
|
+
|
|
4460
|
+
|
|
4461
|
+
|
|
4462
|
+
|
|
4463
|
+
|
|
4464
|
+
|
|
3283
4465
|
* @example
|
|
3284
4466
|
* // Transform entries
|
|
3285
4467
|
* const sl = new SkipList<number, string>([[1, 'a'], [2, 'b']]);
|
|
@@ -3305,6 +4487,30 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
3305
4487
|
|
|
3306
4488
|
|
|
3307
4489
|
|
|
4490
|
+
|
|
4491
|
+
|
|
4492
|
+
|
|
4493
|
+
|
|
4494
|
+
|
|
4495
|
+
|
|
4496
|
+
|
|
4497
|
+
|
|
4498
|
+
|
|
4499
|
+
|
|
4500
|
+
|
|
4501
|
+
|
|
4502
|
+
|
|
4503
|
+
|
|
4504
|
+
|
|
4505
|
+
|
|
4506
|
+
|
|
4507
|
+
|
|
4508
|
+
|
|
4509
|
+
|
|
4510
|
+
|
|
4511
|
+
|
|
4512
|
+
|
|
4513
|
+
|
|
3308
4514
|
* @example
|
|
3309
4515
|
* // Filter entries
|
|
3310
4516
|
* const sl = new SkipList<number, string>([[1, 'a'], [2, 'b'], [3, 'c']]);
|
|
@@ -3382,6 +4588,6 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
3382
4588
|
* @license MIT License
|
|
3383
4589
|
*/
|
|
3384
4590
|
|
|
3385
|
-
export { DFSOperation, DoublyLinkedList, DoublyLinkedListNode, ERR, Range, SinglyLinkedList, SinglyLinkedListNode, SkipList, SkipListNode };
|
|
4591
|
+
export { DFSOperation, DoublyLinkedList, DoublyLinkedListNode, ERR, Range, SinglyLinkedList, SinglyLinkedListNode, SkipList, SkipListNode, raise };
|
|
3386
4592
|
//# sourceMappingURL=index.mjs.map
|
|
3387
4593
|
//# sourceMappingURL=index.mjs.map
|