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