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