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