data-structure-typed 2.5.2 → 2.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -1
- package/MIGRATION.md +169 -0
- package/README.md +60 -6
- package/README_CN.md +551 -143
- package/SPECIFICATION.md +20 -14
- package/SPECIFICATION.zh-CN.md +20 -14
- package/dist/cjs/binary-tree.cjs +2417 -132
- package/dist/cjs/graph.cjs +248 -14
- package/dist/cjs/hash.cjs +62 -7
- package/dist/cjs/heap.cjs +103 -16
- package/dist/cjs/index.cjs +3046 -124
- package/dist/cjs/linked-list.cjs +219 -0
- package/dist/cjs/matrix.cjs +32 -0
- package/dist/cjs/priority-queue.cjs +101 -14
- package/dist/cjs/queue.cjs +215 -0
- package/dist/cjs/stack.cjs +44 -4
- package/dist/cjs/trie.cjs +44 -0
- package/dist/cjs-legacy/binary-tree.cjs +2406 -123
- package/dist/cjs-legacy/graph.cjs +248 -14
- package/dist/cjs-legacy/hash.cjs +62 -7
- package/dist/cjs-legacy/heap.cjs +103 -16
- package/dist/cjs-legacy/index.cjs +3105 -185
- package/dist/cjs-legacy/linked-list.cjs +219 -0
- package/dist/cjs-legacy/matrix.cjs +32 -0
- package/dist/cjs-legacy/priority-queue.cjs +101 -14
- package/dist/cjs-legacy/queue.cjs +215 -0
- package/dist/cjs-legacy/stack.cjs +44 -4
- package/dist/cjs-legacy/trie.cjs +44 -0
- package/dist/esm/binary-tree.mjs +2417 -132
- package/dist/esm/graph.mjs +248 -14
- package/dist/esm/hash.mjs +62 -7
- package/dist/esm/heap.mjs +103 -16
- package/dist/esm/index.mjs +3046 -124
- package/dist/esm/linked-list.mjs +219 -0
- package/dist/esm/matrix.mjs +32 -0
- package/dist/esm/priority-queue.mjs +101 -14
- package/dist/esm/queue.mjs +215 -0
- package/dist/esm/stack.mjs +44 -4
- package/dist/esm/trie.mjs +44 -0
- package/dist/esm-legacy/binary-tree.mjs +2406 -123
- package/dist/esm-legacy/graph.mjs +248 -14
- package/dist/esm-legacy/hash.mjs +62 -7
- package/dist/esm-legacy/heap.mjs +103 -16
- package/dist/esm-legacy/index.mjs +3105 -185
- package/dist/esm-legacy/linked-list.mjs +219 -0
- package/dist/esm-legacy/matrix.mjs +32 -0
- package/dist/esm-legacy/priority-queue.mjs +101 -14
- package/dist/esm-legacy/queue.mjs +215 -0
- package/dist/esm-legacy/stack.mjs +44 -4
- package/dist/esm-legacy/trie.mjs +44 -0
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +50 -2
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +56 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +116 -15
- package/dist/types/data-structures/binary-tree/bst.d.ts +99 -3
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +79 -8
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +24 -0
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +520 -1
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +489 -1
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +393 -1
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +500 -1
- package/dist/types/data-structures/graph/directed-graph.d.ts +40 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +36 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +51 -6
- package/dist/types/data-structures/heap/heap.d.ts +98 -12
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +75 -0
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +61 -1
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +72 -0
- package/dist/types/data-structures/matrix/matrix.d.ts +32 -0
- package/dist/types/data-structures/queue/deque.d.ts +82 -0
- package/dist/types/data-structures/queue/queue.d.ts +61 -0
- package/dist/types/data-structures/stack/stack.d.ts +42 -2
- package/dist/types/data-structures/trie/trie.d.ts +48 -0
- package/dist/types/interfaces/binary-tree.d.ts +2 -3
- package/dist/umd/data-structure-typed.js +3105 -185
- package/dist/umd/data-structure-typed.min.js +4 -4
- package/docs-site-docusaurus/docs/api/classes/AVLTree.md +188 -200
- package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +11 -11
- package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +62 -62
- package/docs-site-docusaurus/docs/api/classes/BST.md +183 -195
- package/docs-site-docusaurus/docs/api/classes/BSTNode.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +15 -15
- package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +143 -155
- package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/Deque.md +99 -85
- package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +73 -73
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +100 -70
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedListNode.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +12 -12
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +1 -1
- package/docs-site-docusaurus/docs/api/classes/HashMap.md +38 -38
- package/docs-site-docusaurus/docs/api/classes/Heap.md +96 -85
- package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +25 -25
- package/docs-site-docusaurus/docs/api/classes/IterableEntryBase.md +23 -23
- package/docs-site-docusaurus/docs/api/classes/LinearBase.md +48 -48
- package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +52 -52
- package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +42 -42
- package/docs-site-docusaurus/docs/api/classes/LinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +74 -74
- package/docs-site-docusaurus/docs/api/classes/MapGraph.md +73 -73
- package/docs-site-docusaurus/docs/api/classes/Matrix.md +31 -31
- package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +104 -89
- package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +104 -89
- package/docs-site-docusaurus/docs/api/classes/MinHeap.md +104 -89
- package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +104 -89
- package/docs-site-docusaurus/docs/api/classes/Navigator.md +5 -5
- package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +103 -88
- package/docs-site-docusaurus/docs/api/classes/Queue.md +111 -59
- package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +200 -212
- package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +10 -10
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +75 -75
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/SkipList.md +37 -37
- package/docs-site-docusaurus/docs/api/classes/Stack.md +42 -42
- package/docs-site-docusaurus/docs/api/classes/TreeMap.md +107 -36
- package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +43 -43
- package/docs-site-docusaurus/docs/api/classes/TreeSet.md +106 -35
- package/docs-site-docusaurus/docs/api/classes/Trie.md +43 -43
- package/docs-site-docusaurus/docs/api/classes/TrieNode.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +72 -72
- package/docs-site-docusaurus/docs/guide/architecture.md +75 -7
- package/docs-site-docusaurus/docs/guide/concepts.md +53 -34
- package/docs-site-docusaurus/docs/guide/faq.md +53 -0
- package/docs-site-docusaurus/docs/guide/guides.md +8 -9
- package/docs-site-docusaurus/docs/guide/integrations.md +74 -177
- package/docs-site-docusaurus/docs/guide/overview.md +131 -17
- package/docs-site-docusaurus/src/pages/index.tsx +4 -0
- package/docs-site-docusaurus/typedoc.json +1 -0
- package/package.json +7 -6
- package/src/data-structures/binary-tree/avl-tree.ts +52 -5
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +56 -0
- package/src/data-structures/binary-tree/binary-tree.ts +167 -81
- package/src/data-structures/binary-tree/bst.ts +101 -7
- package/src/data-structures/binary-tree/red-black-tree.ts +82 -15
- package/src/data-structures/binary-tree/segment-tree.ts +24 -0
- package/src/data-structures/binary-tree/tree-map.ts +540 -3
- package/src/data-structures/binary-tree/tree-multi-map.ts +490 -2
- package/src/data-structures/binary-tree/tree-multi-set.ts +393 -1
- package/src/data-structures/binary-tree/tree-set.ts +520 -3
- package/src/data-structures/graph/directed-graph.ts +41 -1
- package/src/data-structures/graph/undirected-graph.ts +37 -1
- package/src/data-structures/hash/hash-map.ts +67 -12
- package/src/data-structures/heap/heap.ts +107 -19
- package/src/data-structures/linked-list/doubly-linked-list.ts +88 -0
- package/src/data-structures/linked-list/singly-linked-list.ts +61 -1
- package/src/data-structures/linked-list/skip-linked-list.ts +72 -0
- package/src/data-structures/matrix/matrix.ts +32 -0
- package/src/data-structures/queue/deque.ts +85 -0
- package/src/data-structures/queue/queue.ts +73 -0
- package/src/data-structures/stack/stack.ts +45 -5
- package/src/data-structures/trie/trie.ts +48 -0
- package/src/interfaces/binary-tree.ts +1 -9
- package/.vitepress/cache/deps_temp_51f5f1b0/chunk-7OIKW5WK.js +0 -12984
- package/.vitepress/cache/deps_temp_51f5f1b0/package.json +0 -3
- package/.vitepress/cache/deps_temp_51f5f1b0/vitepress___@vue_devtools-api.js +0 -4505
- package/.vitepress/cache/deps_temp_51f5f1b0/vitepress___@vueuse_core.js +0 -9731
- package/.vitepress/cache/deps_temp_51f5f1b0/vue.js +0 -347
|
@@ -799,6 +799,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
799
799
|
|
|
800
800
|
|
|
801
801
|
|
|
802
|
+
|
|
803
|
+
|
|
804
|
+
|
|
805
|
+
|
|
802
806
|
|
|
803
807
|
|
|
804
808
|
|
|
@@ -849,6 +853,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
849
853
|
|
|
850
854
|
|
|
851
855
|
|
|
856
|
+
|
|
857
|
+
|
|
858
|
+
|
|
859
|
+
|
|
852
860
|
|
|
853
861
|
|
|
854
862
|
|
|
@@ -863,6 +871,14 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
863
871
|
get first() {
|
|
864
872
|
return this.length > 0 ? this.elements[this._offset] : void 0;
|
|
865
873
|
}
|
|
874
|
+
/**
|
|
875
|
+
* Peek at the front element without removing it (alias for `first`).
|
|
876
|
+
* @remarks Time O(1), Space O(1)
|
|
877
|
+
* @returns Front element or undefined.
|
|
878
|
+
*/
|
|
879
|
+
peek() {
|
|
880
|
+
return this.first;
|
|
881
|
+
}
|
|
866
882
|
/**
|
|
867
883
|
* Get the last element (back) without removing it.
|
|
868
884
|
* @remarks Time O(1), Space O(1)
|
|
@@ -915,6 +931,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
915
931
|
|
|
916
932
|
|
|
917
933
|
|
|
934
|
+
|
|
935
|
+
|
|
936
|
+
|
|
937
|
+
|
|
918
938
|
|
|
919
939
|
|
|
920
940
|
|
|
@@ -977,6 +997,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
977
997
|
|
|
978
998
|
|
|
979
999
|
|
|
1000
|
+
|
|
1001
|
+
|
|
1002
|
+
|
|
1003
|
+
|
|
980
1004
|
|
|
981
1005
|
|
|
982
1006
|
|
|
@@ -1046,6 +1070,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1046
1070
|
|
|
1047
1071
|
|
|
1048
1072
|
|
|
1073
|
+
|
|
1074
|
+
|
|
1075
|
+
|
|
1076
|
+
|
|
1049
1077
|
|
|
1050
1078
|
|
|
1051
1079
|
|
|
@@ -1105,6 +1133,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1105
1133
|
|
|
1106
1134
|
|
|
1107
1135
|
|
|
1136
|
+
|
|
1137
|
+
|
|
1138
|
+
|
|
1139
|
+
|
|
1108
1140
|
|
|
1109
1141
|
|
|
1110
1142
|
|
|
@@ -1157,6 +1189,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1157
1189
|
|
|
1158
1190
|
|
|
1159
1191
|
|
|
1192
|
+
|
|
1193
|
+
|
|
1194
|
+
|
|
1195
|
+
|
|
1160
1196
|
|
|
1161
1197
|
|
|
1162
1198
|
|
|
@@ -1208,6 +1244,21 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1208
1244
|
this._elements[this._offset + index] = newElement;
|
|
1209
1245
|
return true;
|
|
1210
1246
|
}
|
|
1247
|
+
/**
|
|
1248
|
+
* Delete the first element that satisfies a predicate.
|
|
1249
|
+
* @remarks Time O(N), Space O(N)
|
|
1250
|
+
* @param predicate - Function (value, index, queue) → boolean to decide deletion.
|
|
1251
|
+
* @returns True if a match was removed.
|
|
1252
|
+
*/
|
|
1253
|
+
deleteWhere(predicate) {
|
|
1254
|
+
for (let i = 0; i < this.length; i++) {
|
|
1255
|
+
if (predicate(this._elements[this._offset + i], i, this)) {
|
|
1256
|
+
this.deleteAt(i);
|
|
1257
|
+
return true;
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
return false;
|
|
1261
|
+
}
|
|
1211
1262
|
/**
|
|
1212
1263
|
* Reverse the queue in-place by compacting then reversing.
|
|
1213
1264
|
* @remarks Time O(N), Space O(N)
|
|
@@ -1250,6 +1301,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1250
1301
|
|
|
1251
1302
|
|
|
1252
1303
|
|
|
1304
|
+
|
|
1305
|
+
|
|
1306
|
+
|
|
1307
|
+
|
|
1253
1308
|
|
|
1254
1309
|
|
|
1255
1310
|
|
|
@@ -1296,6 +1351,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1296
1351
|
|
|
1297
1352
|
|
|
1298
1353
|
|
|
1354
|
+
|
|
1355
|
+
|
|
1356
|
+
|
|
1357
|
+
|
|
1299
1358
|
|
|
1300
1359
|
|
|
1301
1360
|
|
|
@@ -1365,6 +1424,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1365
1424
|
|
|
1366
1425
|
|
|
1367
1426
|
|
|
1427
|
+
|
|
1428
|
+
|
|
1429
|
+
|
|
1430
|
+
|
|
1368
1431
|
|
|
1369
1432
|
|
|
1370
1433
|
|
|
@@ -1418,6 +1481,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1418
1481
|
|
|
1419
1482
|
|
|
1420
1483
|
|
|
1484
|
+
|
|
1485
|
+
|
|
1486
|
+
|
|
1487
|
+
|
|
1421
1488
|
|
|
1422
1489
|
|
|
1423
1490
|
|
|
@@ -1475,6 +1542,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1475
1542
|
|
|
1476
1543
|
|
|
1477
1544
|
|
|
1545
|
+
|
|
1546
|
+
|
|
1547
|
+
|
|
1548
|
+
|
|
1478
1549
|
|
|
1479
1550
|
|
|
1480
1551
|
|
|
@@ -1954,7 +2025,7 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
1954
2025
|
}
|
|
1955
2026
|
/**
|
|
1956
2027
|
* Adds a new node to the tree.
|
|
1957
|
-
* @remarks Time O(
|
|
2028
|
+
* @remarks Time O(N) — level-order traversal to find an empty slot. Space O(N) for the BFS queue. BST/Red-Black Tree/AVL Tree subclasses override to O(log N).
|
|
1958
2029
|
*
|
|
1959
2030
|
* @param keyNodeOrEntry - The key, node, or entry to add.
|
|
1960
2031
|
* @returns True if the addition was successful, false otherwise.
|
|
@@ -1983,6 +2054,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
1983
2054
|
|
|
1984
2055
|
|
|
1985
2056
|
|
|
2057
|
+
|
|
2058
|
+
|
|
2059
|
+
|
|
2060
|
+
|
|
1986
2061
|
|
|
1987
2062
|
|
|
1988
2063
|
|
|
@@ -2002,7 +2077,7 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2002
2077
|
}
|
|
2003
2078
|
/**
|
|
2004
2079
|
* Adds or updates a new node to the tree.
|
|
2005
|
-
* @remarks Time O(
|
|
2080
|
+
* @remarks Time O(N) — level-order traversal to find an empty slot. Space O(N) for the BFS queue. BST/Red-Black Tree/AVL Tree subclasses override to O(log N).
|
|
2006
2081
|
*
|
|
2007
2082
|
* @param keyNodeOrEntry - The key, node, or entry to set or update.
|
|
2008
2083
|
* @param [value] - The value, if providing just a key.
|
|
@@ -2037,6 +2112,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2037
2112
|
|
|
2038
2113
|
|
|
2039
2114
|
|
|
2115
|
+
|
|
2116
|
+
|
|
2117
|
+
|
|
2118
|
+
|
|
2040
2119
|
|
|
2041
2120
|
|
|
2042
2121
|
|
|
@@ -2143,6 +2222,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2143
2222
|
|
|
2144
2223
|
|
|
2145
2224
|
|
|
2225
|
+
|
|
2226
|
+
|
|
2227
|
+
|
|
2228
|
+
|
|
2146
2229
|
|
|
2147
2230
|
|
|
2148
2231
|
|
|
@@ -2185,6 +2268,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2185
2268
|
|
|
2186
2269
|
|
|
2187
2270
|
|
|
2271
|
+
|
|
2272
|
+
|
|
2273
|
+
|
|
2274
|
+
|
|
2188
2275
|
|
|
2189
2276
|
|
|
2190
2277
|
|
|
@@ -2248,6 +2335,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2248
2335
|
|
|
2249
2336
|
|
|
2250
2337
|
|
|
2338
|
+
|
|
2339
|
+
|
|
2340
|
+
|
|
2341
|
+
|
|
2251
2342
|
|
|
2252
2343
|
|
|
2253
2344
|
|
|
@@ -2264,22 +2355,66 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2264
2355
|
this.setMany(anotherTree, []);
|
|
2265
2356
|
}
|
|
2266
2357
|
/**
|
|
2267
|
-
*
|
|
2268
|
-
* @remarks Time O(N)
|
|
2358
|
+
* Deletes a node from the tree (internal, returns balancing metadata).
|
|
2359
|
+
* @remarks Time O(N) — O(N) to find the node + O(H) for predecessor swap. Space O(1). BST/Red-Black Tree/AVL Tree subclasses override to O(log N).
|
|
2360
|
+
* @internal Used by AVL/BST subclasses that need balancing metadata after deletion.
|
|
2269
2361
|
*
|
|
2270
|
-
* @param
|
|
2271
|
-
* @
|
|
2362
|
+
* @param keyNodeEntryRawOrPredicate - The node to delete.
|
|
2363
|
+
* @returns An array containing deletion results with balancing metadata.
|
|
2272
2364
|
*/
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
this.
|
|
2365
|
+
_deleteInternal(keyNodeEntryRawOrPredicate) {
|
|
2366
|
+
const deletedResult = [];
|
|
2367
|
+
if (!this._root) return deletedResult;
|
|
2368
|
+
const curr = this.getNode(keyNodeEntryRawOrPredicate);
|
|
2369
|
+
if (!curr) return deletedResult;
|
|
2370
|
+
const parent = curr == null ? void 0 : curr.parent;
|
|
2371
|
+
let needBalanced;
|
|
2372
|
+
let orgCurrent = curr;
|
|
2373
|
+
if (!curr.left && !curr.right && !parent) {
|
|
2374
|
+
this._setRoot(void 0);
|
|
2375
|
+
} else if (curr.left) {
|
|
2376
|
+
const leftSubTreeRightMost = this.getRightMost((node) => node, curr.left);
|
|
2377
|
+
if (leftSubTreeRightMost) {
|
|
2378
|
+
const parentOfLeftSubTreeMax = leftSubTreeRightMost.parent;
|
|
2379
|
+
orgCurrent = this._swapProperties(curr, leftSubTreeRightMost);
|
|
2380
|
+
if (this._isMapMode) {
|
|
2381
|
+
this._store.set(curr.key, curr);
|
|
2382
|
+
this._store.set(leftSubTreeRightMost.key, leftSubTreeRightMost);
|
|
2383
|
+
}
|
|
2384
|
+
if (parentOfLeftSubTreeMax) {
|
|
2385
|
+
if (parentOfLeftSubTreeMax.right === leftSubTreeRightMost)
|
|
2386
|
+
parentOfLeftSubTreeMax.right = leftSubTreeRightMost.left;
|
|
2387
|
+
else parentOfLeftSubTreeMax.left = leftSubTreeRightMost.left;
|
|
2388
|
+
needBalanced = parentOfLeftSubTreeMax;
|
|
2389
|
+
}
|
|
2390
|
+
}
|
|
2391
|
+
} else if (parent) {
|
|
2392
|
+
const { familyPosition: fp } = curr;
|
|
2393
|
+
if (fp === "LEFT" || fp === "ROOT_LEFT") {
|
|
2394
|
+
parent.left = curr.right;
|
|
2395
|
+
} else if (fp === "RIGHT" || fp === "ROOT_RIGHT") {
|
|
2396
|
+
parent.right = curr.right;
|
|
2397
|
+
}
|
|
2398
|
+
needBalanced = parent;
|
|
2399
|
+
} else {
|
|
2400
|
+
this._setRoot(curr.right);
|
|
2401
|
+
curr.right = void 0;
|
|
2402
|
+
}
|
|
2403
|
+
this._size = this._size - 1;
|
|
2404
|
+
deletedResult.push({ deleted: orgCurrent, needBalanced });
|
|
2405
|
+
if (this._isMapMode && orgCurrent) this._store.delete(orgCurrent.key);
|
|
2406
|
+
return deletedResult;
|
|
2276
2407
|
}
|
|
2277
2408
|
/**
|
|
2278
2409
|
* Deletes a node from the tree.
|
|
2279
|
-
* @remarks Time O(
|
|
2410
|
+
* @remarks Time O(N) — O(N) to find the node + O(H) for predecessor swap. Space O(1). BST/Red-Black Tree/AVL Tree subclasses override to O(log N).
|
|
2280
2411
|
*
|
|
2281
2412
|
* @param keyNodeEntryRawOrPredicate - The node to delete.
|
|
2282
|
-
* @returns
|
|
2413
|
+
* @returns True if the node was found and deleted, false otherwise.
|
|
2414
|
+
|
|
2415
|
+
|
|
2416
|
+
|
|
2417
|
+
|
|
2283
2418
|
|
|
2284
2419
|
|
|
2285
2420
|
|
|
@@ -2323,51 +2458,11 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2323
2458
|
* console.log(tree.size); // 4;
|
|
2324
2459
|
*/
|
|
2325
2460
|
delete(keyNodeEntryRawOrPredicate) {
|
|
2326
|
-
|
|
2327
|
-
if (!this._root) return deletedResult;
|
|
2328
|
-
const curr = this.getNode(keyNodeEntryRawOrPredicate);
|
|
2329
|
-
if (!curr) return deletedResult;
|
|
2330
|
-
const parent = curr == null ? void 0 : curr.parent;
|
|
2331
|
-
let needBalanced;
|
|
2332
|
-
let orgCurrent = curr;
|
|
2333
|
-
if (!curr.left && !curr.right && !parent) {
|
|
2334
|
-
this._setRoot(void 0);
|
|
2335
|
-
} else if (curr.left) {
|
|
2336
|
-
const leftSubTreeRightMost = this.getRightMost((node) => node, curr.left);
|
|
2337
|
-
if (leftSubTreeRightMost) {
|
|
2338
|
-
const parentOfLeftSubTreeMax = leftSubTreeRightMost.parent;
|
|
2339
|
-
orgCurrent = this._swapProperties(curr, leftSubTreeRightMost);
|
|
2340
|
-
if (this._isMapMode) {
|
|
2341
|
-
this._store.set(curr.key, curr);
|
|
2342
|
-
this._store.set(leftSubTreeRightMost.key, leftSubTreeRightMost);
|
|
2343
|
-
}
|
|
2344
|
-
if (parentOfLeftSubTreeMax) {
|
|
2345
|
-
if (parentOfLeftSubTreeMax.right === leftSubTreeRightMost)
|
|
2346
|
-
parentOfLeftSubTreeMax.right = leftSubTreeRightMost.left;
|
|
2347
|
-
else parentOfLeftSubTreeMax.left = leftSubTreeRightMost.left;
|
|
2348
|
-
needBalanced = parentOfLeftSubTreeMax;
|
|
2349
|
-
}
|
|
2350
|
-
}
|
|
2351
|
-
} else if (parent) {
|
|
2352
|
-
const { familyPosition: fp } = curr;
|
|
2353
|
-
if (fp === "LEFT" || fp === "ROOT_LEFT") {
|
|
2354
|
-
parent.left = curr.right;
|
|
2355
|
-
} else if (fp === "RIGHT" || fp === "ROOT_RIGHT") {
|
|
2356
|
-
parent.right = curr.right;
|
|
2357
|
-
}
|
|
2358
|
-
needBalanced = parent;
|
|
2359
|
-
} else {
|
|
2360
|
-
this._setRoot(curr.right);
|
|
2361
|
-
curr.right = void 0;
|
|
2362
|
-
}
|
|
2363
|
-
this._size = this._size - 1;
|
|
2364
|
-
deletedResult.push({ deleted: orgCurrent, needBalanced });
|
|
2365
|
-
if (this._isMapMode && orgCurrent) this._store.delete(orgCurrent.key);
|
|
2366
|
-
return deletedResult;
|
|
2461
|
+
return this._deleteInternal(keyNodeEntryRawOrPredicate).length > 0;
|
|
2367
2462
|
}
|
|
2368
2463
|
/**
|
|
2369
2464
|
* Searches the tree for nodes matching a predicate.
|
|
2370
|
-
* @remarks Time O(
|
|
2465
|
+
* @remarks Time O(N) — full DFS scan; may visit every node. Space O(H) for call/explicit stack (O(N) worst-case). BST subclasses with key search override to O(log N).
|
|
2371
2466
|
*
|
|
2372
2467
|
* @template C - The type of the callback function.
|
|
2373
2468
|
* @param keyNodeEntryOrPredicate - The key, node, entry, or predicate function to search for.
|
|
@@ -2416,7 +2511,7 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2416
2511
|
}
|
|
2417
2512
|
/**
|
|
2418
2513
|
* Gets the first node matching a predicate.
|
|
2419
|
-
* @remarks Time O(
|
|
2514
|
+
* @remarks Time O(N) via `search`. Space O(H) or O(N). BST/Red-Black Tree/AVL Tree subclasses override to O(log N) for key lookups.
|
|
2420
2515
|
*
|
|
2421
2516
|
* @param keyNodeEntryOrPredicate - The key, node, entry, or predicate function to search for.
|
|
2422
2517
|
* @param [startNode=this._root] - The node to start the search from.
|
|
@@ -2450,6 +2545,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2450
2545
|
|
|
2451
2546
|
|
|
2452
2547
|
|
|
2548
|
+
|
|
2549
|
+
|
|
2550
|
+
|
|
2551
|
+
|
|
2453
2552
|
|
|
2454
2553
|
|
|
2455
2554
|
|
|
@@ -2472,7 +2571,7 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2472
2571
|
}
|
|
2473
2572
|
/**
|
|
2474
2573
|
* Gets the value associated with a key.
|
|
2475
|
-
* @remarks Time O(
|
|
2574
|
+
* @remarks Time O(1) in Map mode, O(N) otherwise (via `getNode`). Space O(1) in Map mode, O(H) or O(N) otherwise. BST subclasses override non-Map-mode to O(log N).
|
|
2476
2575
|
*
|
|
2477
2576
|
* @param keyNodeEntryOrPredicate - The key, node, or entry to get the value for.
|
|
2478
2577
|
* @param [startNode=this._root] - The node to start searching from (if not in Map mode).
|
|
@@ -2508,6 +2607,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2508
2607
|
|
|
2509
2608
|
|
|
2510
2609
|
|
|
2610
|
+
|
|
2611
|
+
|
|
2612
|
+
|
|
2613
|
+
|
|
2511
2614
|
|
|
2512
2615
|
|
|
2513
2616
|
|
|
@@ -2569,6 +2672,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2569
2672
|
|
|
2570
2673
|
|
|
2571
2674
|
|
|
2675
|
+
|
|
2676
|
+
|
|
2677
|
+
|
|
2678
|
+
|
|
2572
2679
|
|
|
2573
2680
|
|
|
2574
2681
|
|
|
@@ -2617,6 +2724,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2617
2724
|
|
|
2618
2725
|
|
|
2619
2726
|
|
|
2727
|
+
|
|
2728
|
+
|
|
2729
|
+
|
|
2730
|
+
|
|
2620
2731
|
|
|
2621
2732
|
|
|
2622
2733
|
|
|
@@ -2674,6 +2785,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2674
2785
|
|
|
2675
2786
|
|
|
2676
2787
|
|
|
2788
|
+
|
|
2789
|
+
|
|
2790
|
+
|
|
2791
|
+
|
|
2677
2792
|
|
|
2678
2793
|
|
|
2679
2794
|
|
|
@@ -2758,6 +2873,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2758
2873
|
|
|
2759
2874
|
|
|
2760
2875
|
|
|
2876
|
+
|
|
2877
|
+
|
|
2878
|
+
|
|
2879
|
+
|
|
2761
2880
|
|
|
2762
2881
|
|
|
2763
2882
|
|
|
@@ -2819,6 +2938,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2819
2938
|
|
|
2820
2939
|
|
|
2821
2940
|
|
|
2941
|
+
|
|
2942
|
+
|
|
2943
|
+
|
|
2944
|
+
|
|
2822
2945
|
|
|
2823
2946
|
|
|
2824
2947
|
|
|
@@ -3296,6 +3419,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
3296
3419
|
|
|
3297
3420
|
|
|
3298
3421
|
|
|
3422
|
+
|
|
3423
|
+
|
|
3424
|
+
|
|
3425
|
+
|
|
3299
3426
|
|
|
3300
3427
|
|
|
3301
3428
|
|
|
@@ -3348,6 +3475,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
3348
3475
|
|
|
3349
3476
|
|
|
3350
3477
|
|
|
3478
|
+
|
|
3479
|
+
|
|
3480
|
+
|
|
3481
|
+
|
|
3351
3482
|
|
|
3352
3483
|
|
|
3353
3484
|
|
|
@@ -3404,6 +3535,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
3404
3535
|
|
|
3405
3536
|
|
|
3406
3537
|
|
|
3538
|
+
|
|
3539
|
+
|
|
3540
|
+
|
|
3541
|
+
|
|
3407
3542
|
|
|
3408
3543
|
|
|
3409
3544
|
|
|
@@ -3485,6 +3620,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
3485
3620
|
|
|
3486
3621
|
|
|
3487
3622
|
|
|
3623
|
+
|
|
3624
|
+
|
|
3625
|
+
|
|
3626
|
+
|
|
3488
3627
|
|
|
3489
3628
|
|
|
3490
3629
|
|
|
@@ -4297,6 +4436,14 @@ var _BST = class _BST extends BinaryTree {
|
|
|
4297
4436
|
|
|
4298
4437
|
|
|
4299
4438
|
|
|
4439
|
+
|
|
4440
|
+
|
|
4441
|
+
|
|
4442
|
+
|
|
4443
|
+
|
|
4444
|
+
|
|
4445
|
+
|
|
4446
|
+
|
|
4300
4447
|
|
|
4301
4448
|
|
|
4302
4449
|
|
|
@@ -4631,6 +4778,18 @@ var _BST = class _BST extends BinaryTree {
|
|
|
4631
4778
|
|
|
4632
4779
|
|
|
4633
4780
|
|
|
4781
|
+
|
|
4782
|
+
|
|
4783
|
+
|
|
4784
|
+
|
|
4785
|
+
|
|
4786
|
+
|
|
4787
|
+
|
|
4788
|
+
|
|
4789
|
+
|
|
4790
|
+
|
|
4791
|
+
|
|
4792
|
+
|
|
4634
4793
|
|
|
4635
4794
|
|
|
4636
4795
|
|
|
@@ -4750,6 +4909,14 @@ var _BST = class _BST extends BinaryTree {
|
|
|
4750
4909
|
|
|
4751
4910
|
|
|
4752
4911
|
|
|
4912
|
+
|
|
4913
|
+
|
|
4914
|
+
|
|
4915
|
+
|
|
4916
|
+
|
|
4917
|
+
|
|
4918
|
+
|
|
4919
|
+
|
|
4753
4920
|
|
|
4754
4921
|
|
|
4755
4922
|
|
|
@@ -5041,6 +5208,10 @@ var _BST = class _BST extends BinaryTree {
|
|
|
5041
5208
|
|
|
5042
5209
|
|
|
5043
5210
|
|
|
5211
|
+
|
|
5212
|
+
|
|
5213
|
+
|
|
5214
|
+
|
|
5044
5215
|
|
|
5045
5216
|
|
|
5046
5217
|
|
|
@@ -5110,6 +5281,10 @@ var _BST = class _BST extends BinaryTree {
|
|
|
5110
5281
|
|
|
5111
5282
|
|
|
5112
5283
|
|
|
5284
|
+
|
|
5285
|
+
|
|
5286
|
+
|
|
5287
|
+
|
|
5113
5288
|
|
|
5114
5289
|
|
|
5115
5290
|
|
|
@@ -5228,6 +5403,14 @@ var _BST = class _BST extends BinaryTree {
|
|
|
5228
5403
|
|
|
5229
5404
|
|
|
5230
5405
|
|
|
5406
|
+
|
|
5407
|
+
|
|
5408
|
+
|
|
5409
|
+
|
|
5410
|
+
|
|
5411
|
+
|
|
5412
|
+
|
|
5413
|
+
|
|
5231
5414
|
|
|
5232
5415
|
|
|
5233
5416
|
|
|
@@ -5289,12 +5472,11 @@ var _BST = class _BST extends BinaryTree {
|
|
|
5289
5472
|
*/
|
|
5290
5473
|
deleteWhere(keyNodeEntryOrPredicate, onlyOne = false, startNode = this._root, iterationType = this.iterationType) {
|
|
5291
5474
|
const toDelete = this.search(keyNodeEntryOrPredicate, onlyOne, (node) => node, startNode, iterationType);
|
|
5292
|
-
let
|
|
5475
|
+
let deleted = false;
|
|
5293
5476
|
for (const node of toDelete) {
|
|
5294
|
-
|
|
5295
|
-
results = results.concat(deleteInfo);
|
|
5477
|
+
if (this.delete(node)) deleted = true;
|
|
5296
5478
|
}
|
|
5297
|
-
return
|
|
5479
|
+
return deleted;
|
|
5298
5480
|
}
|
|
5299
5481
|
/**
|
|
5300
5482
|
* (Protected) Creates the default comparator function for keys that don't have a custom comparator.
|
|
@@ -5923,6 +6105,14 @@ var _BinaryIndexedTree = class _BinaryIndexedTree {
|
|
|
5923
6105
|
|
|
5924
6106
|
|
|
5925
6107
|
|
|
6108
|
+
|
|
6109
|
+
|
|
6110
|
+
|
|
6111
|
+
|
|
6112
|
+
|
|
6113
|
+
|
|
6114
|
+
|
|
6115
|
+
|
|
5926
6116
|
|
|
5927
6117
|
|
|
5928
6118
|
|
|
@@ -5999,6 +6189,14 @@ var _BinaryIndexedTree = class _BinaryIndexedTree {
|
|
|
5999
6189
|
|
|
6000
6190
|
|
|
6001
6191
|
|
|
6192
|
+
|
|
6193
|
+
|
|
6194
|
+
|
|
6195
|
+
|
|
6196
|
+
|
|
6197
|
+
|
|
6198
|
+
|
|
6199
|
+
|
|
6002
6200
|
|
|
6003
6201
|
|
|
6004
6202
|
|
|
@@ -6075,6 +6273,14 @@ var _BinaryIndexedTree = class _BinaryIndexedTree {
|
|
|
6075
6273
|
|
|
6076
6274
|
|
|
6077
6275
|
|
|
6276
|
+
|
|
6277
|
+
|
|
6278
|
+
|
|
6279
|
+
|
|
6280
|
+
|
|
6281
|
+
|
|
6282
|
+
|
|
6283
|
+
|
|
6078
6284
|
|
|
6079
6285
|
|
|
6080
6286
|
|
|
@@ -6151,6 +6357,14 @@ var _BinaryIndexedTree = class _BinaryIndexedTree {
|
|
|
6151
6357
|
|
|
6152
6358
|
|
|
6153
6359
|
|
|
6360
|
+
|
|
6361
|
+
|
|
6362
|
+
|
|
6363
|
+
|
|
6364
|
+
|
|
6365
|
+
|
|
6366
|
+
|
|
6367
|
+
|
|
6154
6368
|
|
|
6155
6369
|
|
|
6156
6370
|
|
|
@@ -6225,6 +6439,14 @@ var _BinaryIndexedTree = class _BinaryIndexedTree {
|
|
|
6225
6439
|
|
|
6226
6440
|
|
|
6227
6441
|
|
|
6442
|
+
|
|
6443
|
+
|
|
6444
|
+
|
|
6445
|
+
|
|
6446
|
+
|
|
6447
|
+
|
|
6448
|
+
|
|
6449
|
+
|
|
6228
6450
|
|
|
6229
6451
|
|
|
6230
6452
|
|
|
@@ -6306,6 +6528,14 @@ var _BinaryIndexedTree = class _BinaryIndexedTree {
|
|
|
6306
6528
|
|
|
6307
6529
|
|
|
6308
6530
|
|
|
6531
|
+
|
|
6532
|
+
|
|
6533
|
+
|
|
6534
|
+
|
|
6535
|
+
|
|
6536
|
+
|
|
6537
|
+
|
|
6538
|
+
|
|
6309
6539
|
|
|
6310
6540
|
|
|
6311
6541
|
|
|
@@ -6360,6 +6590,10 @@ var _BinaryIndexedTree = class _BinaryIndexedTree {
|
|
|
6360
6590
|
|
|
6361
6591
|
|
|
6362
6592
|
|
|
6593
|
+
|
|
6594
|
+
|
|
6595
|
+
|
|
6596
|
+
|
|
6363
6597
|
|
|
6364
6598
|
|
|
6365
6599
|
|
|
@@ -6421,6 +6655,10 @@ var _BinaryIndexedTree = class _BinaryIndexedTree {
|
|
|
6421
6655
|
|
|
6422
6656
|
|
|
6423
6657
|
|
|
6658
|
+
|
|
6659
|
+
|
|
6660
|
+
|
|
6661
|
+
|
|
6424
6662
|
|
|
6425
6663
|
|
|
6426
6664
|
|
|
@@ -6584,6 +6822,10 @@ var _SegmentTree = class _SegmentTree {
|
|
|
6584
6822
|
|
|
6585
6823
|
|
|
6586
6824
|
|
|
6825
|
+
|
|
6826
|
+
|
|
6827
|
+
|
|
6828
|
+
|
|
6587
6829
|
|
|
6588
6830
|
|
|
6589
6831
|
|
|
@@ -6656,6 +6898,10 @@ var _SegmentTree = class _SegmentTree {
|
|
|
6656
6898
|
|
|
6657
6899
|
|
|
6658
6900
|
|
|
6901
|
+
|
|
6902
|
+
|
|
6903
|
+
|
|
6904
|
+
|
|
6659
6905
|
|
|
6660
6906
|
|
|
6661
6907
|
|
|
@@ -6722,6 +6968,10 @@ var _SegmentTree = class _SegmentTree {
|
|
|
6722
6968
|
|
|
6723
6969
|
|
|
6724
6970
|
|
|
6971
|
+
|
|
6972
|
+
|
|
6973
|
+
|
|
6974
|
+
|
|
6725
6975
|
|
|
6726
6976
|
|
|
6727
6977
|
|
|
@@ -6795,6 +7045,10 @@ var _SegmentTree = class _SegmentTree {
|
|
|
6795
7045
|
|
|
6796
7046
|
|
|
6797
7047
|
|
|
7048
|
+
|
|
7049
|
+
|
|
7050
|
+
|
|
7051
|
+
|
|
6798
7052
|
|
|
6799
7053
|
|
|
6800
7054
|
|
|
@@ -6846,6 +7100,10 @@ var _SegmentTree = class _SegmentTree {
|
|
|
6846
7100
|
|
|
6847
7101
|
|
|
6848
7102
|
|
|
7103
|
+
|
|
7104
|
+
|
|
7105
|
+
|
|
7106
|
+
|
|
6849
7107
|
|
|
6850
7108
|
|
|
6851
7109
|
|
|
@@ -6923,6 +7181,10 @@ var _SegmentTree = class _SegmentTree {
|
|
|
6923
7181
|
|
|
6924
7182
|
|
|
6925
7183
|
|
|
7184
|
+
|
|
7185
|
+
|
|
7186
|
+
|
|
7187
|
+
|
|
6926
7188
|
|
|
6927
7189
|
|
|
6928
7190
|
|
|
@@ -7306,6 +7568,22 @@ var _AVLTree = class _AVLTree extends BST {
|
|
|
7306
7568
|
|
|
7307
7569
|
|
|
7308
7570
|
|
|
7571
|
+
|
|
7572
|
+
|
|
7573
|
+
|
|
7574
|
+
|
|
7575
|
+
|
|
7576
|
+
|
|
7577
|
+
|
|
7578
|
+
|
|
7579
|
+
|
|
7580
|
+
|
|
7581
|
+
|
|
7582
|
+
|
|
7583
|
+
|
|
7584
|
+
|
|
7585
|
+
|
|
7586
|
+
|
|
7309
7587
|
|
|
7310
7588
|
|
|
7311
7589
|
|
|
@@ -7434,6 +7712,18 @@ var _AVLTree = class _AVLTree extends BST {
|
|
|
7434
7712
|
|
|
7435
7713
|
|
|
7436
7714
|
|
|
7715
|
+
|
|
7716
|
+
|
|
7717
|
+
|
|
7718
|
+
|
|
7719
|
+
|
|
7720
|
+
|
|
7721
|
+
|
|
7722
|
+
|
|
7723
|
+
|
|
7724
|
+
|
|
7725
|
+
|
|
7726
|
+
|
|
7437
7727
|
|
|
7438
7728
|
|
|
7439
7729
|
|
|
@@ -7455,13 +7745,13 @@ var _AVLTree = class _AVLTree extends BST {
|
|
|
7455
7745
|
* console.log(avl.size); // 6;
|
|
7456
7746
|
*/
|
|
7457
7747
|
delete(keyNodeOrEntry) {
|
|
7458
|
-
const deletedResults =
|
|
7748
|
+
const deletedResults = this._deleteInternal(keyNodeOrEntry);
|
|
7459
7749
|
for (const { needBalanced } of deletedResults) {
|
|
7460
7750
|
if (needBalanced) {
|
|
7461
7751
|
this._balancePath(needBalanced);
|
|
7462
7752
|
}
|
|
7463
7753
|
}
|
|
7464
|
-
return deletedResults;
|
|
7754
|
+
return deletedResults.length > 0;
|
|
7465
7755
|
}
|
|
7466
7756
|
/**
|
|
7467
7757
|
* Rebuilds the tree to be perfectly balanced.
|
|
@@ -7521,6 +7811,14 @@ var _AVLTree = class _AVLTree extends BST {
|
|
|
7521
7811
|
|
|
7522
7812
|
|
|
7523
7813
|
|
|
7814
|
+
|
|
7815
|
+
|
|
7816
|
+
|
|
7817
|
+
|
|
7818
|
+
|
|
7819
|
+
|
|
7820
|
+
|
|
7821
|
+
|
|
7524
7822
|
|
|
7525
7823
|
|
|
7526
7824
|
|
|
@@ -7653,6 +7951,18 @@ var _AVLTree = class _AVLTree extends BST {
|
|
|
7653
7951
|
|
|
7654
7952
|
|
|
7655
7953
|
|
|
7954
|
+
|
|
7955
|
+
|
|
7956
|
+
|
|
7957
|
+
|
|
7958
|
+
|
|
7959
|
+
|
|
7960
|
+
|
|
7961
|
+
|
|
7962
|
+
|
|
7963
|
+
|
|
7964
|
+
|
|
7965
|
+
|
|
7656
7966
|
|
|
7657
7967
|
|
|
7658
7968
|
|
|
@@ -8153,13 +8463,24 @@ var _RedBlackTree = class _RedBlackTree extends BST {
|
|
|
8153
8463
|
return keyNodeOrEntry instanceof RedBlackTreeNode;
|
|
8154
8464
|
}
|
|
8155
8465
|
/**
|
|
8156
|
-
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
|
|
8160
|
-
|
|
8161
|
-
|
|
8162
|
-
|
|
8466
|
+
* Remove all nodes, clear the key→value store (if in map mode) and internal caches.
|
|
8467
|
+
* @remarks Time O(n), Space O(1)
|
|
8468
|
+
|
|
8469
|
+
|
|
8470
|
+
|
|
8471
|
+
|
|
8472
|
+
|
|
8473
|
+
|
|
8474
|
+
|
|
8475
|
+
|
|
8476
|
+
|
|
8477
|
+
|
|
8478
|
+
|
|
8479
|
+
|
|
8480
|
+
|
|
8481
|
+
|
|
8482
|
+
|
|
8483
|
+
|
|
8163
8484
|
|
|
8164
8485
|
|
|
8165
8486
|
|
|
@@ -8752,6 +9073,22 @@ var _RedBlackTree = class _RedBlackTree extends BST {
|
|
|
8752
9073
|
|
|
8753
9074
|
|
|
8754
9075
|
|
|
9076
|
+
|
|
9077
|
+
|
|
9078
|
+
|
|
9079
|
+
|
|
9080
|
+
|
|
9081
|
+
|
|
9082
|
+
|
|
9083
|
+
|
|
9084
|
+
|
|
9085
|
+
|
|
9086
|
+
|
|
9087
|
+
|
|
9088
|
+
|
|
9089
|
+
|
|
9090
|
+
|
|
9091
|
+
|
|
8755
9092
|
|
|
8756
9093
|
|
|
8757
9094
|
|
|
@@ -8951,6 +9288,22 @@ var _RedBlackTree = class _RedBlackTree extends BST {
|
|
|
8951
9288
|
|
|
8952
9289
|
|
|
8953
9290
|
|
|
9291
|
+
|
|
9292
|
+
|
|
9293
|
+
|
|
9294
|
+
|
|
9295
|
+
|
|
9296
|
+
|
|
9297
|
+
|
|
9298
|
+
|
|
9299
|
+
|
|
9300
|
+
|
|
9301
|
+
|
|
9302
|
+
|
|
9303
|
+
|
|
9304
|
+
|
|
9305
|
+
|
|
9306
|
+
|
|
8954
9307
|
|
|
8955
9308
|
|
|
8956
9309
|
|
|
@@ -8977,13 +9330,12 @@ var _RedBlackTree = class _RedBlackTree extends BST {
|
|
|
8977
9330
|
*/
|
|
8978
9331
|
delete(keyNodeEntryRawOrPredicate) {
|
|
8979
9332
|
var _a, _b, _c;
|
|
8980
|
-
if (keyNodeEntryRawOrPredicate === null) return
|
|
8981
|
-
const results = [];
|
|
9333
|
+
if (keyNodeEntryRawOrPredicate === null) return false;
|
|
8982
9334
|
let nodeToDelete;
|
|
8983
9335
|
if (this._isPredicate(keyNodeEntryRawOrPredicate)) nodeToDelete = this.getNode(keyNodeEntryRawOrPredicate);
|
|
8984
9336
|
else nodeToDelete = this.isRealNode(keyNodeEntryRawOrPredicate) ? keyNodeEntryRawOrPredicate : this.getNode(keyNodeEntryRawOrPredicate);
|
|
8985
9337
|
if (!nodeToDelete) {
|
|
8986
|
-
return
|
|
9338
|
+
return false;
|
|
8987
9339
|
}
|
|
8988
9340
|
const willDeleteMin = nodeToDelete === this._minNode;
|
|
8989
9341
|
const willDeleteMax = nodeToDelete === this._maxNode;
|
|
@@ -9039,8 +9391,7 @@ var _RedBlackTree = class _RedBlackTree extends BST {
|
|
|
9039
9391
|
if (originalColor === "BLACK") {
|
|
9040
9392
|
this._deleteFixup(replacementNode);
|
|
9041
9393
|
}
|
|
9042
|
-
|
|
9043
|
-
return results;
|
|
9394
|
+
return true;
|
|
9044
9395
|
}
|
|
9045
9396
|
/**
|
|
9046
9397
|
* Transform entries into a like-kind red-black tree with possibly different key/value types.
|
|
@@ -9141,6 +9492,18 @@ var _RedBlackTree = class _RedBlackTree extends BST {
|
|
|
9141
9492
|
|
|
9142
9493
|
|
|
9143
9494
|
|
|
9495
|
+
|
|
9496
|
+
|
|
9497
|
+
|
|
9498
|
+
|
|
9499
|
+
|
|
9500
|
+
|
|
9501
|
+
|
|
9502
|
+
|
|
9503
|
+
|
|
9504
|
+
|
|
9505
|
+
|
|
9506
|
+
|
|
9144
9507
|
|
|
9145
9508
|
|
|
9146
9509
|
|
|
@@ -9289,6 +9652,22 @@ var _RedBlackTree = class _RedBlackTree extends BST {
|
|
|
9289
9652
|
|
|
9290
9653
|
|
|
9291
9654
|
|
|
9655
|
+
|
|
9656
|
+
|
|
9657
|
+
|
|
9658
|
+
|
|
9659
|
+
|
|
9660
|
+
|
|
9661
|
+
|
|
9662
|
+
|
|
9663
|
+
|
|
9664
|
+
|
|
9665
|
+
|
|
9666
|
+
|
|
9667
|
+
|
|
9668
|
+
|
|
9669
|
+
|
|
9670
|
+
|
|
9292
9671
|
|
|
9293
9672
|
|
|
9294
9673
|
|
|
@@ -9804,6 +10183,26 @@ var _TreeSet = class _TreeSet {
|
|
|
9804
10183
|
|
|
9805
10184
|
|
|
9806
10185
|
|
|
10186
|
+
|
|
10187
|
+
|
|
10188
|
+
|
|
10189
|
+
|
|
10190
|
+
|
|
10191
|
+
|
|
10192
|
+
|
|
10193
|
+
|
|
10194
|
+
|
|
10195
|
+
|
|
10196
|
+
|
|
10197
|
+
|
|
10198
|
+
|
|
10199
|
+
|
|
10200
|
+
|
|
10201
|
+
|
|
10202
|
+
|
|
10203
|
+
|
|
10204
|
+
|
|
10205
|
+
|
|
9807
10206
|
|
|
9808
10207
|
|
|
9809
10208
|
|
|
@@ -10009,28 +10408,103 @@ var _TreeSet = class _TreeSet {
|
|
|
10009
10408
|
|
|
10010
10409
|
|
|
10011
10410
|
|
|
10012
|
-
|
|
10013
|
-
|
|
10014
|
-
|
|
10015
|
-
|
|
10016
|
-
|
|
10017
|
-
|
|
10018
|
-
|
|
10019
|
-
|
|
10020
|
-
|
|
10021
|
-
|
|
10022
|
-
|
|
10023
|
-
|
|
10024
|
-
|
|
10025
|
-
|
|
10026
|
-
|
|
10027
|
-
|
|
10028
|
-
|
|
10029
|
-
|
|
10030
|
-
|
|
10031
|
-
|
|
10032
|
-
|
|
10033
|
-
|
|
10411
|
+
|
|
10412
|
+
|
|
10413
|
+
|
|
10414
|
+
|
|
10415
|
+
|
|
10416
|
+
|
|
10417
|
+
|
|
10418
|
+
|
|
10419
|
+
|
|
10420
|
+
|
|
10421
|
+
|
|
10422
|
+
|
|
10423
|
+
|
|
10424
|
+
|
|
10425
|
+
|
|
10426
|
+
|
|
10427
|
+
|
|
10428
|
+
|
|
10429
|
+
|
|
10430
|
+
|
|
10431
|
+
* @example
|
|
10432
|
+
* // Unique tags with sorted order
|
|
10433
|
+
* const tags = new TreeSet<string>(['javascript', 'typescript', 'react', 'typescript', 'node']);
|
|
10434
|
+
*
|
|
10435
|
+
* // Duplicates removed, sorted alphabetically
|
|
10436
|
+
* console.log([...tags]); // ['javascript', 'node', 'react', 'typescript'];
|
|
10437
|
+
* console.log(tags.size); // 4;
|
|
10438
|
+
*
|
|
10439
|
+
* tags.add('angular');
|
|
10440
|
+
* console.log(tags.first()); // 'angular';
|
|
10441
|
+
* console.log(tags.last()); // 'typescript';
|
|
10442
|
+
*/
|
|
10443
|
+
add(key) {
|
|
10444
|
+
this._validateKey(key);
|
|
10445
|
+
__privateGet(this, _core).set(key, void 0);
|
|
10446
|
+
return this;
|
|
10447
|
+
}
|
|
10448
|
+
/**
|
|
10449
|
+
* Add multiple keys at once.
|
|
10450
|
+
* @remarks Expected time O(m log n), where m is the number of keys.
|
|
10451
|
+
* @param keys - Iterable of keys to add.
|
|
10452
|
+
* @returns Array of booleans indicating whether each key was newly added.
|
|
10453
|
+
|
|
10454
|
+
|
|
10455
|
+
|
|
10456
|
+
|
|
10457
|
+
|
|
10458
|
+
|
|
10459
|
+
|
|
10460
|
+
|
|
10461
|
+
|
|
10462
|
+
|
|
10463
|
+
|
|
10464
|
+
|
|
10465
|
+
|
|
10466
|
+
|
|
10467
|
+
|
|
10468
|
+
|
|
10469
|
+
* @example
|
|
10470
|
+
* // Add multiple keys
|
|
10471
|
+
* const ts = new TreeSet<number>();
|
|
10472
|
+
* ts.addMany([5, 3, 7, 1, 9]);
|
|
10473
|
+
* console.log(ts.size); // 5;
|
|
10474
|
+
*/
|
|
10475
|
+
addMany(keys) {
|
|
10476
|
+
const results = [];
|
|
10477
|
+
for (const key of keys) {
|
|
10478
|
+
this._validateKey(key);
|
|
10479
|
+
results.push(__privateGet(this, _core).set(key, void 0));
|
|
10480
|
+
}
|
|
10481
|
+
return results;
|
|
10482
|
+
}
|
|
10483
|
+
/**
|
|
10484
|
+
* Test whether a key exists.
|
|
10485
|
+
* @remarks Expected time O(log n)
|
|
10486
|
+
|
|
10487
|
+
|
|
10488
|
+
|
|
10489
|
+
|
|
10490
|
+
|
|
10491
|
+
|
|
10492
|
+
|
|
10493
|
+
|
|
10494
|
+
|
|
10495
|
+
|
|
10496
|
+
|
|
10497
|
+
|
|
10498
|
+
|
|
10499
|
+
|
|
10500
|
+
|
|
10501
|
+
|
|
10502
|
+
|
|
10503
|
+
|
|
10504
|
+
|
|
10505
|
+
|
|
10506
|
+
|
|
10507
|
+
|
|
10034
10508
|
|
|
10035
10509
|
|
|
10036
10510
|
|
|
@@ -10361,6 +10835,26 @@ var _TreeSet = class _TreeSet {
|
|
|
10361
10835
|
|
|
10362
10836
|
|
|
10363
10837
|
|
|
10838
|
+
|
|
10839
|
+
|
|
10840
|
+
|
|
10841
|
+
|
|
10842
|
+
|
|
10843
|
+
|
|
10844
|
+
|
|
10845
|
+
|
|
10846
|
+
|
|
10847
|
+
|
|
10848
|
+
|
|
10849
|
+
|
|
10850
|
+
|
|
10851
|
+
|
|
10852
|
+
|
|
10853
|
+
|
|
10854
|
+
|
|
10855
|
+
|
|
10856
|
+
|
|
10857
|
+
|
|
10364
10858
|
|
|
10365
10859
|
|
|
10366
10860
|
|
|
@@ -10391,10 +10885,25 @@ var _TreeSet = class _TreeSet {
|
|
|
10391
10885
|
* console.log([...nums]); // [1, 3, 7, 9];
|
|
10392
10886
|
*/
|
|
10393
10887
|
delete(key) {
|
|
10394
|
-
var _a;
|
|
10395
10888
|
this._validateKey(key);
|
|
10396
|
-
|
|
10397
|
-
|
|
10889
|
+
return __privateGet(this, _core).delete(key);
|
|
10890
|
+
}
|
|
10891
|
+
/**
|
|
10892
|
+
* Delete all keys matching a predicate.
|
|
10893
|
+
* @remarks Time O(N), Space O(N)
|
|
10894
|
+
* @param predicate - Function (key, index, set) → boolean; return true to delete.
|
|
10895
|
+
* @returns True if at least one key was deleted.
|
|
10896
|
+
*/
|
|
10897
|
+
deleteWhere(predicate) {
|
|
10898
|
+
let deleted = false;
|
|
10899
|
+
let index = 0;
|
|
10900
|
+
for (const key of this) {
|
|
10901
|
+
if (predicate(key, index++, this)) {
|
|
10902
|
+
this.delete(key);
|
|
10903
|
+
deleted = true;
|
|
10904
|
+
}
|
|
10905
|
+
}
|
|
10906
|
+
return deleted;
|
|
10398
10907
|
}
|
|
10399
10908
|
/**
|
|
10400
10909
|
* Remove all keys.
|
|
@@ -10535,6 +11044,26 @@ var _TreeSet = class _TreeSet {
|
|
|
10535
11044
|
|
|
10536
11045
|
|
|
10537
11046
|
|
|
11047
|
+
|
|
11048
|
+
|
|
11049
|
+
|
|
11050
|
+
|
|
11051
|
+
|
|
11052
|
+
|
|
11053
|
+
|
|
11054
|
+
|
|
11055
|
+
|
|
11056
|
+
|
|
11057
|
+
|
|
11058
|
+
|
|
11059
|
+
|
|
11060
|
+
|
|
11061
|
+
|
|
11062
|
+
|
|
11063
|
+
|
|
11064
|
+
|
|
11065
|
+
|
|
11066
|
+
|
|
10538
11067
|
|
|
10539
11068
|
|
|
10540
11069
|
|
|
@@ -10704,6 +11233,26 @@ var _TreeSet = class _TreeSet {
|
|
|
10704
11233
|
|
|
10705
11234
|
|
|
10706
11235
|
|
|
11236
|
+
|
|
11237
|
+
|
|
11238
|
+
|
|
11239
|
+
|
|
11240
|
+
|
|
11241
|
+
|
|
11242
|
+
|
|
11243
|
+
|
|
11244
|
+
|
|
11245
|
+
|
|
11246
|
+
|
|
11247
|
+
|
|
11248
|
+
|
|
11249
|
+
|
|
11250
|
+
|
|
11251
|
+
|
|
11252
|
+
|
|
11253
|
+
|
|
11254
|
+
|
|
11255
|
+
|
|
10707
11256
|
|
|
10708
11257
|
|
|
10709
11258
|
|
|
@@ -10874,6 +11423,26 @@ var _TreeSet = class _TreeSet {
|
|
|
10874
11423
|
|
|
10875
11424
|
|
|
10876
11425
|
|
|
11426
|
+
|
|
11427
|
+
|
|
11428
|
+
|
|
11429
|
+
|
|
11430
|
+
|
|
11431
|
+
|
|
11432
|
+
|
|
11433
|
+
|
|
11434
|
+
|
|
11435
|
+
|
|
11436
|
+
|
|
11437
|
+
|
|
11438
|
+
|
|
11439
|
+
|
|
11440
|
+
|
|
11441
|
+
|
|
11442
|
+
|
|
11443
|
+
|
|
11444
|
+
|
|
11445
|
+
|
|
10877
11446
|
|
|
10878
11447
|
|
|
10879
11448
|
|
|
@@ -11044,6 +11613,26 @@ var _TreeSet = class _TreeSet {
|
|
|
11044
11613
|
|
|
11045
11614
|
|
|
11046
11615
|
|
|
11616
|
+
|
|
11617
|
+
|
|
11618
|
+
|
|
11619
|
+
|
|
11620
|
+
|
|
11621
|
+
|
|
11622
|
+
|
|
11623
|
+
|
|
11624
|
+
|
|
11625
|
+
|
|
11626
|
+
|
|
11627
|
+
|
|
11628
|
+
|
|
11629
|
+
|
|
11630
|
+
|
|
11631
|
+
|
|
11632
|
+
|
|
11633
|
+
|
|
11634
|
+
|
|
11635
|
+
|
|
11047
11636
|
|
|
11048
11637
|
|
|
11049
11638
|
|
|
@@ -11217,6 +11806,26 @@ var _TreeSet = class _TreeSet {
|
|
|
11217
11806
|
|
|
11218
11807
|
|
|
11219
11808
|
|
|
11809
|
+
|
|
11810
|
+
|
|
11811
|
+
|
|
11812
|
+
|
|
11813
|
+
|
|
11814
|
+
|
|
11815
|
+
|
|
11816
|
+
|
|
11817
|
+
|
|
11818
|
+
|
|
11819
|
+
|
|
11820
|
+
|
|
11821
|
+
|
|
11822
|
+
|
|
11823
|
+
|
|
11824
|
+
|
|
11825
|
+
|
|
11826
|
+
|
|
11827
|
+
|
|
11828
|
+
|
|
11220
11829
|
|
|
11221
11830
|
|
|
11222
11831
|
|
|
@@ -11390,6 +11999,26 @@ var _TreeSet = class _TreeSet {
|
|
|
11390
11999
|
|
|
11391
12000
|
|
|
11392
12001
|
|
|
12002
|
+
|
|
12003
|
+
|
|
12004
|
+
|
|
12005
|
+
|
|
12006
|
+
|
|
12007
|
+
|
|
12008
|
+
|
|
12009
|
+
|
|
12010
|
+
|
|
12011
|
+
|
|
12012
|
+
|
|
12013
|
+
|
|
12014
|
+
|
|
12015
|
+
|
|
12016
|
+
|
|
12017
|
+
|
|
12018
|
+
|
|
12019
|
+
|
|
12020
|
+
|
|
12021
|
+
|
|
11393
12022
|
|
|
11394
12023
|
|
|
11395
12024
|
|
|
@@ -11566,6 +12195,26 @@ var _TreeSet = class _TreeSet {
|
|
|
11566
12195
|
|
|
11567
12196
|
|
|
11568
12197
|
|
|
12198
|
+
|
|
12199
|
+
|
|
12200
|
+
|
|
12201
|
+
|
|
12202
|
+
|
|
12203
|
+
|
|
12204
|
+
|
|
12205
|
+
|
|
12206
|
+
|
|
12207
|
+
|
|
12208
|
+
|
|
12209
|
+
|
|
12210
|
+
|
|
12211
|
+
|
|
12212
|
+
|
|
12213
|
+
|
|
12214
|
+
|
|
12215
|
+
|
|
12216
|
+
|
|
12217
|
+
|
|
11569
12218
|
|
|
11570
12219
|
|
|
11571
12220
|
|
|
@@ -11742,6 +12391,26 @@ var _TreeSet = class _TreeSet {
|
|
|
11742
12391
|
|
|
11743
12392
|
|
|
11744
12393
|
|
|
12394
|
+
|
|
12395
|
+
|
|
12396
|
+
|
|
12397
|
+
|
|
12398
|
+
|
|
12399
|
+
|
|
12400
|
+
|
|
12401
|
+
|
|
12402
|
+
|
|
12403
|
+
|
|
12404
|
+
|
|
12405
|
+
|
|
12406
|
+
|
|
12407
|
+
|
|
12408
|
+
|
|
12409
|
+
|
|
12410
|
+
|
|
12411
|
+
|
|
12412
|
+
|
|
12413
|
+
|
|
11745
12414
|
|
|
11746
12415
|
|
|
11747
12416
|
|
|
@@ -11913,6 +12582,26 @@ var _TreeSet = class _TreeSet {
|
|
|
11913
12582
|
|
|
11914
12583
|
|
|
11915
12584
|
|
|
12585
|
+
|
|
12586
|
+
|
|
12587
|
+
|
|
12588
|
+
|
|
12589
|
+
|
|
12590
|
+
|
|
12591
|
+
|
|
12592
|
+
|
|
12593
|
+
|
|
12594
|
+
|
|
12595
|
+
|
|
12596
|
+
|
|
12597
|
+
|
|
12598
|
+
|
|
12599
|
+
|
|
12600
|
+
|
|
12601
|
+
|
|
12602
|
+
|
|
12603
|
+
|
|
12604
|
+
|
|
11916
12605
|
|
|
11917
12606
|
|
|
11918
12607
|
|
|
@@ -12085,6 +12774,26 @@ var _TreeSet = class _TreeSet {
|
|
|
12085
12774
|
|
|
12086
12775
|
|
|
12087
12776
|
|
|
12777
|
+
|
|
12778
|
+
|
|
12779
|
+
|
|
12780
|
+
|
|
12781
|
+
|
|
12782
|
+
|
|
12783
|
+
|
|
12784
|
+
|
|
12785
|
+
|
|
12786
|
+
|
|
12787
|
+
|
|
12788
|
+
|
|
12789
|
+
|
|
12790
|
+
|
|
12791
|
+
|
|
12792
|
+
|
|
12793
|
+
|
|
12794
|
+
|
|
12795
|
+
|
|
12796
|
+
|
|
12088
12797
|
|
|
12089
12798
|
|
|
12090
12799
|
|
|
@@ -12278,23 +12987,63 @@ var _TreeSet = class _TreeSet {
|
|
|
12278
12987
|
|
|
12279
12988
|
|
|
12280
12989
|
|
|
12281
|
-
|
|
12282
|
-
|
|
12283
|
-
|
|
12284
|
-
|
|
12285
|
-
|
|
12286
|
-
|
|
12287
|
-
|
|
12288
|
-
|
|
12289
|
-
|
|
12290
|
-
|
|
12291
|
-
|
|
12292
|
-
|
|
12293
|
-
|
|
12294
|
-
|
|
12295
|
-
|
|
12296
|
-
|
|
12297
|
-
|
|
12990
|
+
|
|
12991
|
+
|
|
12992
|
+
|
|
12993
|
+
|
|
12994
|
+
|
|
12995
|
+
|
|
12996
|
+
|
|
12997
|
+
|
|
12998
|
+
|
|
12999
|
+
|
|
13000
|
+
|
|
13001
|
+
|
|
13002
|
+
|
|
13003
|
+
|
|
13004
|
+
|
|
13005
|
+
|
|
13006
|
+
|
|
13007
|
+
|
|
13008
|
+
|
|
13009
|
+
|
|
13010
|
+
* @example
|
|
13011
|
+
* // Find entry
|
|
13012
|
+
* const ts = new TreeSet<number>([1, 2, 3]);
|
|
13013
|
+
* const found = ts.find(k => k === 2);
|
|
13014
|
+
* console.log(found); // 2;
|
|
13015
|
+
*/
|
|
13016
|
+
find(callbackfn, thisArg) {
|
|
13017
|
+
let index = 0;
|
|
13018
|
+
for (const v of this) {
|
|
13019
|
+
const ok = thisArg === void 0 ? callbackfn(v, index++, this) : callbackfn.call(thisArg, v, index++, this);
|
|
13020
|
+
if (ok) return v;
|
|
13021
|
+
}
|
|
13022
|
+
return void 0;
|
|
13023
|
+
}
|
|
13024
|
+
/**
|
|
13025
|
+
* Materialize the set into an array of keys.
|
|
13026
|
+
* @remarks Time O(n), Space O(n)
|
|
13027
|
+
|
|
13028
|
+
|
|
13029
|
+
|
|
13030
|
+
|
|
13031
|
+
|
|
13032
|
+
|
|
13033
|
+
|
|
13034
|
+
|
|
13035
|
+
|
|
13036
|
+
|
|
13037
|
+
|
|
13038
|
+
|
|
13039
|
+
|
|
13040
|
+
|
|
13041
|
+
|
|
13042
|
+
|
|
13043
|
+
|
|
13044
|
+
|
|
13045
|
+
|
|
13046
|
+
|
|
12298
13047
|
|
|
12299
13048
|
|
|
12300
13049
|
|
|
@@ -12601,6 +13350,26 @@ var _TreeSet = class _TreeSet {
|
|
|
12601
13350
|
|
|
12602
13351
|
|
|
12603
13352
|
|
|
13353
|
+
|
|
13354
|
+
|
|
13355
|
+
|
|
13356
|
+
|
|
13357
|
+
|
|
13358
|
+
|
|
13359
|
+
|
|
13360
|
+
|
|
13361
|
+
|
|
13362
|
+
|
|
13363
|
+
|
|
13364
|
+
|
|
13365
|
+
|
|
13366
|
+
|
|
13367
|
+
|
|
13368
|
+
|
|
13369
|
+
|
|
13370
|
+
|
|
13371
|
+
|
|
13372
|
+
|
|
12604
13373
|
|
|
12605
13374
|
|
|
12606
13375
|
|
|
@@ -12663,6 +13432,10 @@ var _TreeSet = class _TreeSet {
|
|
|
12663
13432
|
|
|
12664
13433
|
|
|
12665
13434
|
|
|
13435
|
+
|
|
13436
|
+
|
|
13437
|
+
|
|
13438
|
+
|
|
12666
13439
|
|
|
12667
13440
|
|
|
12668
13441
|
|
|
@@ -12731,6 +13504,10 @@ var _TreeSet = class _TreeSet {
|
|
|
12731
13504
|
|
|
12732
13505
|
|
|
12733
13506
|
|
|
13507
|
+
|
|
13508
|
+
|
|
13509
|
+
|
|
13510
|
+
|
|
12734
13511
|
|
|
12735
13512
|
|
|
12736
13513
|
|
|
@@ -12777,6 +13554,10 @@ var _TreeSet = class _TreeSet {
|
|
|
12777
13554
|
|
|
12778
13555
|
|
|
12779
13556
|
|
|
13557
|
+
|
|
13558
|
+
|
|
13559
|
+
|
|
13560
|
+
|
|
12780
13561
|
|
|
12781
13562
|
|
|
12782
13563
|
|
|
@@ -12828,6 +13609,10 @@ var _TreeSet = class _TreeSet {
|
|
|
12828
13609
|
|
|
12829
13610
|
|
|
12830
13611
|
|
|
13612
|
+
|
|
13613
|
+
|
|
13614
|
+
|
|
13615
|
+
|
|
12831
13616
|
|
|
12832
13617
|
|
|
12833
13618
|
|
|
@@ -12965,6 +13750,22 @@ var _TreeSet = class _TreeSet {
|
|
|
12965
13750
|
|
|
12966
13751
|
|
|
12967
13752
|
|
|
13753
|
+
|
|
13754
|
+
|
|
13755
|
+
|
|
13756
|
+
|
|
13757
|
+
|
|
13758
|
+
|
|
13759
|
+
|
|
13760
|
+
|
|
13761
|
+
|
|
13762
|
+
|
|
13763
|
+
|
|
13764
|
+
|
|
13765
|
+
|
|
13766
|
+
|
|
13767
|
+
|
|
13768
|
+
|
|
12968
13769
|
|
|
12969
13770
|
|
|
12970
13771
|
|
|
@@ -13122,6 +13923,22 @@ var _TreeSet = class _TreeSet {
|
|
|
13122
13923
|
|
|
13123
13924
|
|
|
13124
13925
|
|
|
13926
|
+
|
|
13927
|
+
|
|
13928
|
+
|
|
13929
|
+
|
|
13930
|
+
|
|
13931
|
+
|
|
13932
|
+
|
|
13933
|
+
|
|
13934
|
+
|
|
13935
|
+
|
|
13936
|
+
|
|
13937
|
+
|
|
13938
|
+
|
|
13939
|
+
|
|
13940
|
+
|
|
13941
|
+
|
|
13125
13942
|
|
|
13126
13943
|
|
|
13127
13944
|
|
|
@@ -13271,6 +14088,22 @@ var _TreeSet = class _TreeSet {
|
|
|
13271
14088
|
|
|
13272
14089
|
|
|
13273
14090
|
|
|
14091
|
+
|
|
14092
|
+
|
|
14093
|
+
|
|
14094
|
+
|
|
14095
|
+
|
|
14096
|
+
|
|
14097
|
+
|
|
14098
|
+
|
|
14099
|
+
|
|
14100
|
+
|
|
14101
|
+
|
|
14102
|
+
|
|
14103
|
+
|
|
14104
|
+
|
|
14105
|
+
|
|
14106
|
+
|
|
13274
14107
|
|
|
13275
14108
|
|
|
13276
14109
|
|
|
@@ -13418,6 +14251,22 @@ var _TreeSet = class _TreeSet {
|
|
|
13418
14251
|
|
|
13419
14252
|
|
|
13420
14253
|
|
|
14254
|
+
|
|
14255
|
+
|
|
14256
|
+
|
|
14257
|
+
|
|
14258
|
+
|
|
14259
|
+
|
|
14260
|
+
|
|
14261
|
+
|
|
14262
|
+
|
|
14263
|
+
|
|
14264
|
+
|
|
14265
|
+
|
|
14266
|
+
|
|
14267
|
+
|
|
14268
|
+
|
|
14269
|
+
|
|
13421
14270
|
|
|
13422
14271
|
|
|
13423
14272
|
|
|
@@ -13568,6 +14417,22 @@ var _TreeSet = class _TreeSet {
|
|
|
13568
14417
|
|
|
13569
14418
|
|
|
13570
14419
|
|
|
14420
|
+
|
|
14421
|
+
|
|
14422
|
+
|
|
14423
|
+
|
|
14424
|
+
|
|
14425
|
+
|
|
14426
|
+
|
|
14427
|
+
|
|
14428
|
+
|
|
14429
|
+
|
|
14430
|
+
|
|
14431
|
+
|
|
14432
|
+
|
|
14433
|
+
|
|
14434
|
+
|
|
14435
|
+
|
|
13571
14436
|
|
|
13572
14437
|
|
|
13573
14438
|
|
|
@@ -13657,8 +14522,16 @@ var _TreeSet = class _TreeSet {
|
|
|
13657
14522
|
* Returns elements by rank range (0-indexed, inclusive on both ends).
|
|
13658
14523
|
* @remarks Time O(log n + k). Requires `enableOrderStatistic: true`.
|
|
13659
14524
|
|
|
14525
|
+
|
|
14526
|
+
|
|
14527
|
+
|
|
14528
|
+
|
|
14529
|
+
|
|
14530
|
+
|
|
14531
|
+
|
|
14532
|
+
|
|
13660
14533
|
* @example
|
|
13661
|
-
* // Pagination
|
|
14534
|
+
* // Pagination by position in tree order
|
|
13662
14535
|
* const tree = new TreeSet<number>(
|
|
13663
14536
|
* [10, 20, 30, 40, 50, 60, 70, 80, 90],
|
|
13664
14537
|
* { enableOrderStatistic: true }
|
|
@@ -13816,6 +14689,26 @@ var _TreeSet = class _TreeSet {
|
|
|
13816
14689
|
|
|
13817
14690
|
|
|
13818
14691
|
|
|
14692
|
+
|
|
14693
|
+
|
|
14694
|
+
|
|
14695
|
+
|
|
14696
|
+
|
|
14697
|
+
|
|
14698
|
+
|
|
14699
|
+
|
|
14700
|
+
|
|
14701
|
+
|
|
14702
|
+
|
|
14703
|
+
|
|
14704
|
+
|
|
14705
|
+
|
|
14706
|
+
|
|
14707
|
+
|
|
14708
|
+
|
|
14709
|
+
|
|
14710
|
+
|
|
14711
|
+
|
|
13819
14712
|
|
|
13820
14713
|
|
|
13821
14714
|
|
|
@@ -14070,6 +14963,26 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
14070
14963
|
|
|
14071
14964
|
|
|
14072
14965
|
|
|
14966
|
+
|
|
14967
|
+
|
|
14968
|
+
|
|
14969
|
+
|
|
14970
|
+
|
|
14971
|
+
|
|
14972
|
+
|
|
14973
|
+
|
|
14974
|
+
|
|
14975
|
+
|
|
14976
|
+
|
|
14977
|
+
|
|
14978
|
+
|
|
14979
|
+
|
|
14980
|
+
|
|
14981
|
+
|
|
14982
|
+
|
|
14983
|
+
|
|
14984
|
+
|
|
14985
|
+
|
|
14073
14986
|
|
|
14074
14987
|
|
|
14075
14988
|
|
|
@@ -14238,6 +15151,26 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
14238
15151
|
|
|
14239
15152
|
|
|
14240
15153
|
|
|
15154
|
+
|
|
15155
|
+
|
|
15156
|
+
|
|
15157
|
+
|
|
15158
|
+
|
|
15159
|
+
|
|
15160
|
+
|
|
15161
|
+
|
|
15162
|
+
|
|
15163
|
+
|
|
15164
|
+
|
|
15165
|
+
|
|
15166
|
+
|
|
15167
|
+
|
|
15168
|
+
|
|
15169
|
+
|
|
15170
|
+
|
|
15171
|
+
|
|
15172
|
+
|
|
15173
|
+
|
|
14241
15174
|
|
|
14242
15175
|
|
|
14243
15176
|
|
|
@@ -14293,6 +15226,10 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
14293
15226
|
|
|
14294
15227
|
|
|
14295
15228
|
|
|
15229
|
+
|
|
15230
|
+
|
|
15231
|
+
|
|
15232
|
+
|
|
14296
15233
|
|
|
14297
15234
|
|
|
14298
15235
|
|
|
@@ -14333,6 +15270,10 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
14333
15270
|
|
|
14334
15271
|
|
|
14335
15272
|
|
|
15273
|
+
|
|
15274
|
+
|
|
15275
|
+
|
|
15276
|
+
|
|
14336
15277
|
|
|
14337
15278
|
|
|
14338
15279
|
|
|
@@ -14529,6 +15470,30 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
14529
15470
|
|
|
14530
15471
|
|
|
14531
15472
|
|
|
15473
|
+
|
|
15474
|
+
|
|
15475
|
+
|
|
15476
|
+
|
|
15477
|
+
|
|
15478
|
+
|
|
15479
|
+
|
|
15480
|
+
|
|
15481
|
+
|
|
15482
|
+
|
|
15483
|
+
|
|
15484
|
+
|
|
15485
|
+
|
|
15486
|
+
|
|
15487
|
+
|
|
15488
|
+
|
|
15489
|
+
|
|
15490
|
+
|
|
15491
|
+
|
|
15492
|
+
|
|
15493
|
+
|
|
15494
|
+
|
|
15495
|
+
|
|
15496
|
+
|
|
14532
15497
|
|
|
14533
15498
|
|
|
14534
15499
|
|
|
@@ -14739,6 +15704,30 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
14739
15704
|
|
|
14740
15705
|
|
|
14741
15706
|
|
|
15707
|
+
|
|
15708
|
+
|
|
15709
|
+
|
|
15710
|
+
|
|
15711
|
+
|
|
15712
|
+
|
|
15713
|
+
|
|
15714
|
+
|
|
15715
|
+
|
|
15716
|
+
|
|
15717
|
+
|
|
15718
|
+
|
|
15719
|
+
|
|
15720
|
+
|
|
15721
|
+
|
|
15722
|
+
|
|
15723
|
+
|
|
15724
|
+
|
|
15725
|
+
|
|
15726
|
+
|
|
15727
|
+
|
|
15728
|
+
|
|
15729
|
+
|
|
15730
|
+
|
|
14742
15731
|
|
|
14743
15732
|
|
|
14744
15733
|
|
|
@@ -14905,6 +15894,26 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
14905
15894
|
|
|
14906
15895
|
|
|
14907
15896
|
|
|
15897
|
+
|
|
15898
|
+
|
|
15899
|
+
|
|
15900
|
+
|
|
15901
|
+
|
|
15902
|
+
|
|
15903
|
+
|
|
15904
|
+
|
|
15905
|
+
|
|
15906
|
+
|
|
15907
|
+
|
|
15908
|
+
|
|
15909
|
+
|
|
15910
|
+
|
|
15911
|
+
|
|
15912
|
+
|
|
15913
|
+
|
|
15914
|
+
|
|
15915
|
+
|
|
15916
|
+
|
|
14908
15917
|
|
|
14909
15918
|
|
|
14910
15919
|
|
|
@@ -15140,6 +16149,30 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
15140
16149
|
|
|
15141
16150
|
|
|
15142
16151
|
|
|
16152
|
+
|
|
16153
|
+
|
|
16154
|
+
|
|
16155
|
+
|
|
16156
|
+
|
|
16157
|
+
|
|
16158
|
+
|
|
16159
|
+
|
|
16160
|
+
|
|
16161
|
+
|
|
16162
|
+
|
|
16163
|
+
|
|
16164
|
+
|
|
16165
|
+
|
|
16166
|
+
|
|
16167
|
+
|
|
16168
|
+
|
|
16169
|
+
|
|
16170
|
+
|
|
16171
|
+
|
|
16172
|
+
|
|
16173
|
+
|
|
16174
|
+
|
|
16175
|
+
|
|
15143
16176
|
|
|
15144
16177
|
|
|
15145
16178
|
|
|
@@ -15171,7 +16204,7 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
15171
16204
|
*/
|
|
15172
16205
|
delete(key) {
|
|
15173
16206
|
this._validateKey(key);
|
|
15174
|
-
return __privateGet(this, _core2).delete(key)
|
|
16207
|
+
return __privateGet(this, _core2).delete(key);
|
|
15175
16208
|
}
|
|
15176
16209
|
/**
|
|
15177
16210
|
* Check if a specific value exists in a key's bucket.
|
|
@@ -15197,6 +16230,10 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
15197
16230
|
|
|
15198
16231
|
|
|
15199
16232
|
|
|
16233
|
+
|
|
16234
|
+
|
|
16235
|
+
|
|
16236
|
+
|
|
15200
16237
|
|
|
15201
16238
|
|
|
15202
16239
|
|
|
@@ -15238,6 +16275,10 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
15238
16275
|
|
|
15239
16276
|
|
|
15240
16277
|
|
|
16278
|
+
|
|
16279
|
+
|
|
16280
|
+
|
|
16281
|
+
|
|
15241
16282
|
|
|
15242
16283
|
|
|
15243
16284
|
|
|
@@ -15284,6 +16325,10 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
15284
16325
|
|
|
15285
16326
|
|
|
15286
16327
|
|
|
16328
|
+
|
|
16329
|
+
|
|
16330
|
+
|
|
16331
|
+
|
|
15287
16332
|
|
|
15288
16333
|
|
|
15289
16334
|
|
|
@@ -15464,6 +16509,26 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
15464
16509
|
|
|
15465
16510
|
|
|
15466
16511
|
|
|
16512
|
+
|
|
16513
|
+
|
|
16514
|
+
|
|
16515
|
+
|
|
16516
|
+
|
|
16517
|
+
|
|
16518
|
+
|
|
16519
|
+
|
|
16520
|
+
|
|
16521
|
+
|
|
16522
|
+
|
|
16523
|
+
|
|
16524
|
+
|
|
16525
|
+
|
|
16526
|
+
|
|
16527
|
+
|
|
16528
|
+
|
|
16529
|
+
|
|
16530
|
+
|
|
16531
|
+
|
|
15467
16532
|
|
|
15468
16533
|
|
|
15469
16534
|
|
|
@@ -15635,6 +16700,26 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
15635
16700
|
|
|
15636
16701
|
|
|
15637
16702
|
|
|
16703
|
+
|
|
16704
|
+
|
|
16705
|
+
|
|
16706
|
+
|
|
16707
|
+
|
|
16708
|
+
|
|
16709
|
+
|
|
16710
|
+
|
|
16711
|
+
|
|
16712
|
+
|
|
16713
|
+
|
|
16714
|
+
|
|
16715
|
+
|
|
16716
|
+
|
|
16717
|
+
|
|
16718
|
+
|
|
16719
|
+
|
|
16720
|
+
|
|
16721
|
+
|
|
16722
|
+
|
|
15638
16723
|
|
|
15639
16724
|
|
|
15640
16725
|
|
|
@@ -15691,6 +16776,10 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
15691
16776
|
|
|
15692
16777
|
|
|
15693
16778
|
|
|
16779
|
+
|
|
16780
|
+
|
|
16781
|
+
|
|
16782
|
+
|
|
15694
16783
|
|
|
15695
16784
|
|
|
15696
16785
|
|
|
@@ -15732,6 +16821,10 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
15732
16821
|
|
|
15733
16822
|
|
|
15734
16823
|
|
|
16824
|
+
|
|
16825
|
+
|
|
16826
|
+
|
|
16827
|
+
|
|
15735
16828
|
|
|
15736
16829
|
|
|
15737
16830
|
|
|
@@ -15773,6 +16866,10 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
15773
16866
|
|
|
15774
16867
|
|
|
15775
16868
|
|
|
16869
|
+
|
|
16870
|
+
|
|
16871
|
+
|
|
16872
|
+
|
|
15776
16873
|
|
|
15777
16874
|
|
|
15778
16875
|
|
|
@@ -15848,6 +16945,14 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
15848
16945
|
|
|
15849
16946
|
|
|
15850
16947
|
|
|
16948
|
+
|
|
16949
|
+
|
|
16950
|
+
|
|
16951
|
+
|
|
16952
|
+
|
|
16953
|
+
|
|
16954
|
+
|
|
16955
|
+
|
|
15851
16956
|
|
|
15852
16957
|
|
|
15853
16958
|
|
|
@@ -15929,6 +17034,14 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
15929
17034
|
|
|
15930
17035
|
|
|
15931
17036
|
|
|
17037
|
+
|
|
17038
|
+
|
|
17039
|
+
|
|
17040
|
+
|
|
17041
|
+
|
|
17042
|
+
|
|
17043
|
+
|
|
17044
|
+
|
|
15932
17045
|
|
|
15933
17046
|
|
|
15934
17047
|
|
|
@@ -15979,6 +17092,10 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
15979
17092
|
|
|
15980
17093
|
|
|
15981
17094
|
|
|
17095
|
+
|
|
17096
|
+
|
|
17097
|
+
|
|
17098
|
+
|
|
15982
17099
|
|
|
15983
17100
|
|
|
15984
17101
|
|
|
@@ -16024,6 +17141,10 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
16024
17141
|
|
|
16025
17142
|
|
|
16026
17143
|
|
|
17144
|
+
|
|
17145
|
+
|
|
17146
|
+
|
|
17147
|
+
|
|
16027
17148
|
|
|
16028
17149
|
|
|
16029
17150
|
|
|
@@ -16186,6 +17307,26 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
16186
17307
|
|
|
16187
17308
|
|
|
16188
17309
|
|
|
17310
|
+
|
|
17311
|
+
|
|
17312
|
+
|
|
17313
|
+
|
|
17314
|
+
|
|
17315
|
+
|
|
17316
|
+
|
|
17317
|
+
|
|
17318
|
+
|
|
17319
|
+
|
|
17320
|
+
|
|
17321
|
+
|
|
17322
|
+
|
|
17323
|
+
|
|
17324
|
+
|
|
17325
|
+
|
|
17326
|
+
|
|
17327
|
+
|
|
17328
|
+
|
|
17329
|
+
|
|
16189
17330
|
|
|
16190
17331
|
|
|
16191
17332
|
|
|
@@ -16368,6 +17509,26 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
16368
17509
|
|
|
16369
17510
|
|
|
16370
17511
|
|
|
17512
|
+
|
|
17513
|
+
|
|
17514
|
+
|
|
17515
|
+
|
|
17516
|
+
|
|
17517
|
+
|
|
17518
|
+
|
|
17519
|
+
|
|
17520
|
+
|
|
17521
|
+
|
|
17522
|
+
|
|
17523
|
+
|
|
17524
|
+
|
|
17525
|
+
|
|
17526
|
+
|
|
17527
|
+
|
|
17528
|
+
|
|
17529
|
+
|
|
17530
|
+
|
|
17531
|
+
|
|
16371
17532
|
|
|
16372
17533
|
|
|
16373
17534
|
|
|
@@ -16519,6 +17680,22 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
16519
17680
|
|
|
16520
17681
|
|
|
16521
17682
|
|
|
17683
|
+
|
|
17684
|
+
|
|
17685
|
+
|
|
17686
|
+
|
|
17687
|
+
|
|
17688
|
+
|
|
17689
|
+
|
|
17690
|
+
|
|
17691
|
+
|
|
17692
|
+
|
|
17693
|
+
|
|
17694
|
+
|
|
17695
|
+
|
|
17696
|
+
|
|
17697
|
+
|
|
17698
|
+
|
|
16522
17699
|
|
|
16523
17700
|
|
|
16524
17701
|
|
|
@@ -16665,6 +17842,22 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
16665
17842
|
|
|
16666
17843
|
|
|
16667
17844
|
|
|
17845
|
+
|
|
17846
|
+
|
|
17847
|
+
|
|
17848
|
+
|
|
17849
|
+
|
|
17850
|
+
|
|
17851
|
+
|
|
17852
|
+
|
|
17853
|
+
|
|
17854
|
+
|
|
17855
|
+
|
|
17856
|
+
|
|
17857
|
+
|
|
17858
|
+
|
|
17859
|
+
|
|
17860
|
+
|
|
16668
17861
|
|
|
16669
17862
|
|
|
16670
17863
|
|
|
@@ -16840,6 +18033,26 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
16840
18033
|
|
|
16841
18034
|
|
|
16842
18035
|
|
|
18036
|
+
|
|
18037
|
+
|
|
18038
|
+
|
|
18039
|
+
|
|
18040
|
+
|
|
18041
|
+
|
|
18042
|
+
|
|
18043
|
+
|
|
18044
|
+
|
|
18045
|
+
|
|
18046
|
+
|
|
18047
|
+
|
|
18048
|
+
|
|
18049
|
+
|
|
18050
|
+
|
|
18051
|
+
|
|
18052
|
+
|
|
18053
|
+
|
|
18054
|
+
|
|
18055
|
+
|
|
16843
18056
|
|
|
16844
18057
|
|
|
16845
18058
|
|
|
@@ -17010,6 +18223,26 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
17010
18223
|
|
|
17011
18224
|
|
|
17012
18225
|
|
|
18226
|
+
|
|
18227
|
+
|
|
18228
|
+
|
|
18229
|
+
|
|
18230
|
+
|
|
18231
|
+
|
|
18232
|
+
|
|
18233
|
+
|
|
18234
|
+
|
|
18235
|
+
|
|
18236
|
+
|
|
18237
|
+
|
|
18238
|
+
|
|
18239
|
+
|
|
18240
|
+
|
|
18241
|
+
|
|
18242
|
+
|
|
18243
|
+
|
|
18244
|
+
|
|
18245
|
+
|
|
17013
18246
|
|
|
17014
18247
|
|
|
17015
18248
|
|
|
@@ -17185,6 +18418,26 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
17185
18418
|
|
|
17186
18419
|
|
|
17187
18420
|
|
|
18421
|
+
|
|
18422
|
+
|
|
18423
|
+
|
|
18424
|
+
|
|
18425
|
+
|
|
18426
|
+
|
|
18427
|
+
|
|
18428
|
+
|
|
18429
|
+
|
|
18430
|
+
|
|
18431
|
+
|
|
18432
|
+
|
|
18433
|
+
|
|
18434
|
+
|
|
18435
|
+
|
|
18436
|
+
|
|
18437
|
+
|
|
18438
|
+
|
|
18439
|
+
|
|
18440
|
+
|
|
17188
18441
|
|
|
17189
18442
|
|
|
17190
18443
|
|
|
@@ -17362,6 +18615,26 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
17362
18615
|
|
|
17363
18616
|
|
|
17364
18617
|
|
|
18618
|
+
|
|
18619
|
+
|
|
18620
|
+
|
|
18621
|
+
|
|
18622
|
+
|
|
18623
|
+
|
|
18624
|
+
|
|
18625
|
+
|
|
18626
|
+
|
|
18627
|
+
|
|
18628
|
+
|
|
18629
|
+
|
|
18630
|
+
|
|
18631
|
+
|
|
18632
|
+
|
|
18633
|
+
|
|
18634
|
+
|
|
18635
|
+
|
|
18636
|
+
|
|
18637
|
+
|
|
17365
18638
|
|
|
17366
18639
|
|
|
17367
18640
|
|
|
@@ -17537,6 +18810,26 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
17537
18810
|
|
|
17538
18811
|
|
|
17539
18812
|
|
|
18813
|
+
|
|
18814
|
+
|
|
18815
|
+
|
|
18816
|
+
|
|
18817
|
+
|
|
18818
|
+
|
|
18819
|
+
|
|
18820
|
+
|
|
18821
|
+
|
|
18822
|
+
|
|
18823
|
+
|
|
18824
|
+
|
|
18825
|
+
|
|
18826
|
+
|
|
18827
|
+
|
|
18828
|
+
|
|
18829
|
+
|
|
18830
|
+
|
|
18831
|
+
|
|
18832
|
+
|
|
17540
18833
|
|
|
17541
18834
|
|
|
17542
18835
|
|
|
@@ -17705,6 +18998,26 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
17705
18998
|
|
|
17706
18999
|
|
|
17707
19000
|
|
|
19001
|
+
|
|
19002
|
+
|
|
19003
|
+
|
|
19004
|
+
|
|
19005
|
+
|
|
19006
|
+
|
|
19007
|
+
|
|
19008
|
+
|
|
19009
|
+
|
|
19010
|
+
|
|
19011
|
+
|
|
19012
|
+
|
|
19013
|
+
|
|
19014
|
+
|
|
19015
|
+
|
|
19016
|
+
|
|
19017
|
+
|
|
19018
|
+
|
|
19019
|
+
|
|
19020
|
+
|
|
17708
19021
|
|
|
17709
19022
|
|
|
17710
19023
|
|
|
@@ -17851,6 +19164,22 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
17851
19164
|
|
|
17852
19165
|
|
|
17853
19166
|
|
|
19167
|
+
|
|
19168
|
+
|
|
19169
|
+
|
|
19170
|
+
|
|
19171
|
+
|
|
19172
|
+
|
|
19173
|
+
|
|
19174
|
+
|
|
19175
|
+
|
|
19176
|
+
|
|
19177
|
+
|
|
19178
|
+
|
|
19179
|
+
|
|
19180
|
+
|
|
19181
|
+
|
|
19182
|
+
|
|
17854
19183
|
|
|
17855
19184
|
|
|
17856
19185
|
|
|
@@ -18072,8 +19401,16 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
18072
19401
|
/**
|
|
18073
19402
|
* Get elements by rank range
|
|
18074
19403
|
|
|
19404
|
+
|
|
19405
|
+
|
|
19406
|
+
|
|
19407
|
+
|
|
19408
|
+
|
|
19409
|
+
|
|
19410
|
+
|
|
19411
|
+
|
|
18075
19412
|
* @example
|
|
18076
|
-
* // Pagination
|
|
19413
|
+
* // Pagination by position in tree order
|
|
18077
19414
|
* const tree = new TreeMultiMap<number>(
|
|
18078
19415
|
* [10, 20, 30, 40, 50, 60, 70, 80, 90],
|
|
18079
19416
|
* { enableOrderStatistic: true }
|
|
@@ -18099,6 +19436,26 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
18099
19436
|
|
|
18100
19437
|
|
|
18101
19438
|
|
|
19439
|
+
|
|
19440
|
+
|
|
19441
|
+
|
|
19442
|
+
|
|
19443
|
+
|
|
19444
|
+
|
|
19445
|
+
|
|
19446
|
+
|
|
19447
|
+
|
|
19448
|
+
|
|
19449
|
+
|
|
19450
|
+
|
|
19451
|
+
|
|
19452
|
+
|
|
19453
|
+
|
|
19454
|
+
|
|
19455
|
+
|
|
19456
|
+
|
|
19457
|
+
|
|
19458
|
+
|
|
18102
19459
|
|
|
18103
19460
|
* @example
|
|
18104
19461
|
* // Deep clone
|
|
@@ -18355,6 +19712,26 @@ var _TreeMap = class _TreeMap {
|
|
|
18355
19712
|
|
|
18356
19713
|
|
|
18357
19714
|
|
|
19715
|
+
|
|
19716
|
+
|
|
19717
|
+
|
|
19718
|
+
|
|
19719
|
+
|
|
19720
|
+
|
|
19721
|
+
|
|
19722
|
+
|
|
19723
|
+
|
|
19724
|
+
|
|
19725
|
+
|
|
19726
|
+
|
|
19727
|
+
|
|
19728
|
+
|
|
19729
|
+
|
|
19730
|
+
|
|
19731
|
+
|
|
19732
|
+
|
|
19733
|
+
|
|
19734
|
+
|
|
18358
19735
|
|
|
18359
19736
|
|
|
18360
19737
|
|
|
@@ -18532,6 +19909,26 @@ var _TreeMap = class _TreeMap {
|
|
|
18532
19909
|
|
|
18533
19910
|
|
|
18534
19911
|
|
|
19912
|
+
|
|
19913
|
+
|
|
19914
|
+
|
|
19915
|
+
|
|
19916
|
+
|
|
19917
|
+
|
|
19918
|
+
|
|
19919
|
+
|
|
19920
|
+
|
|
19921
|
+
|
|
19922
|
+
|
|
19923
|
+
|
|
19924
|
+
|
|
19925
|
+
|
|
19926
|
+
|
|
19927
|
+
|
|
19928
|
+
|
|
19929
|
+
|
|
19930
|
+
|
|
19931
|
+
|
|
18535
19932
|
|
|
18536
19933
|
|
|
18537
19934
|
|
|
@@ -18579,6 +19976,41 @@ var _TreeMap = class _TreeMap {
|
|
|
18579
19976
|
__privateGet(this, _core3).set(key, value);
|
|
18580
19977
|
return this;
|
|
18581
19978
|
}
|
|
19979
|
+
/**
|
|
19980
|
+
* Set multiple key-value pairs at once.
|
|
19981
|
+
* @remarks Expected time O(m log n), where m is the number of entries.
|
|
19982
|
+
* @param entries - Iterable of `[key, value]` tuples.
|
|
19983
|
+
* @returns Array of booleans indicating whether each entry was successfully set.
|
|
19984
|
+
|
|
19985
|
+
|
|
19986
|
+
|
|
19987
|
+
|
|
19988
|
+
|
|
19989
|
+
|
|
19990
|
+
|
|
19991
|
+
|
|
19992
|
+
|
|
19993
|
+
|
|
19994
|
+
|
|
19995
|
+
|
|
19996
|
+
|
|
19997
|
+
|
|
19998
|
+
|
|
19999
|
+
|
|
20000
|
+
* @example
|
|
20001
|
+
* // Set multiple key-value pairs
|
|
20002
|
+
* const tm = new TreeMap<number, string>();
|
|
20003
|
+
* tm.setMany([[1, 'a'], [2, 'b'], [3, 'c']]);
|
|
20004
|
+
* console.log(tm.size); // 3;
|
|
20005
|
+
*/
|
|
20006
|
+
setMany(entries) {
|
|
20007
|
+
const results = [];
|
|
20008
|
+
for (const [key, value] of entries) {
|
|
20009
|
+
this._validateKey(key);
|
|
20010
|
+
results.push(__privateGet(this, _core3).set(key, value));
|
|
20011
|
+
}
|
|
20012
|
+
return results;
|
|
20013
|
+
}
|
|
18582
20014
|
/**
|
|
18583
20015
|
* Get the value under a key.
|
|
18584
20016
|
* @remarks Expected time O(log n)
|
|
@@ -18730,6 +20162,26 @@ var _TreeMap = class _TreeMap {
|
|
|
18730
20162
|
|
|
18731
20163
|
|
|
18732
20164
|
|
|
20165
|
+
|
|
20166
|
+
|
|
20167
|
+
|
|
20168
|
+
|
|
20169
|
+
|
|
20170
|
+
|
|
20171
|
+
|
|
20172
|
+
|
|
20173
|
+
|
|
20174
|
+
|
|
20175
|
+
|
|
20176
|
+
|
|
20177
|
+
|
|
20178
|
+
|
|
20179
|
+
|
|
20180
|
+
|
|
20181
|
+
|
|
20182
|
+
|
|
20183
|
+
|
|
20184
|
+
|
|
18733
20185
|
|
|
18734
20186
|
|
|
18735
20187
|
|
|
@@ -18918,6 +20370,26 @@ var _TreeMap = class _TreeMap {
|
|
|
18918
20370
|
|
|
18919
20371
|
|
|
18920
20372
|
|
|
20373
|
+
|
|
20374
|
+
|
|
20375
|
+
|
|
20376
|
+
|
|
20377
|
+
|
|
20378
|
+
|
|
20379
|
+
|
|
20380
|
+
|
|
20381
|
+
|
|
20382
|
+
|
|
20383
|
+
|
|
20384
|
+
|
|
20385
|
+
|
|
20386
|
+
|
|
20387
|
+
|
|
20388
|
+
|
|
20389
|
+
|
|
20390
|
+
|
|
20391
|
+
|
|
20392
|
+
|
|
18921
20393
|
|
|
18922
20394
|
|
|
18923
20395
|
|
|
@@ -19106,6 +20578,26 @@ var _TreeMap = class _TreeMap {
|
|
|
19106
20578
|
|
|
19107
20579
|
|
|
19108
20580
|
|
|
20581
|
+
|
|
20582
|
+
|
|
20583
|
+
|
|
20584
|
+
|
|
20585
|
+
|
|
20586
|
+
|
|
20587
|
+
|
|
20588
|
+
|
|
20589
|
+
|
|
20590
|
+
|
|
20591
|
+
|
|
20592
|
+
|
|
20593
|
+
|
|
20594
|
+
|
|
20595
|
+
|
|
20596
|
+
|
|
20597
|
+
|
|
20598
|
+
|
|
20599
|
+
|
|
20600
|
+
|
|
19109
20601
|
|
|
19110
20602
|
|
|
19111
20603
|
|
|
@@ -19141,10 +20633,25 @@ var _TreeMap = class _TreeMap {
|
|
|
19141
20633
|
* console.log(sessions.size); // 2;
|
|
19142
20634
|
*/
|
|
19143
20635
|
delete(key) {
|
|
19144
|
-
var _a;
|
|
19145
20636
|
this._validateKey(key);
|
|
19146
|
-
|
|
19147
|
-
|
|
20637
|
+
return __privateGet(this, _core3).delete(key);
|
|
20638
|
+
}
|
|
20639
|
+
/**
|
|
20640
|
+
* Delete all entries matching a predicate.
|
|
20641
|
+
* @remarks Time O(N), Space O(N)
|
|
20642
|
+
* @param predicate - Function (key, value, index, map) → boolean; return true to delete.
|
|
20643
|
+
* @returns True if at least one entry was deleted.
|
|
20644
|
+
*/
|
|
20645
|
+
deleteWhere(predicate) {
|
|
20646
|
+
let deleted = false;
|
|
20647
|
+
let index = 0;
|
|
20648
|
+
for (const [key, value] of this) {
|
|
20649
|
+
if (predicate(key, value, index++, this)) {
|
|
20650
|
+
this.delete(key);
|
|
20651
|
+
deleted = true;
|
|
20652
|
+
}
|
|
20653
|
+
}
|
|
20654
|
+
return deleted;
|
|
19148
20655
|
}
|
|
19149
20656
|
/**
|
|
19150
20657
|
* Remove all entries.
|
|
@@ -19285,6 +20792,26 @@ var _TreeMap = class _TreeMap {
|
|
|
19285
20792
|
|
|
19286
20793
|
|
|
19287
20794
|
|
|
20795
|
+
|
|
20796
|
+
|
|
20797
|
+
|
|
20798
|
+
|
|
20799
|
+
|
|
20800
|
+
|
|
20801
|
+
|
|
20802
|
+
|
|
20803
|
+
|
|
20804
|
+
|
|
20805
|
+
|
|
20806
|
+
|
|
20807
|
+
|
|
20808
|
+
|
|
20809
|
+
|
|
20810
|
+
|
|
20811
|
+
|
|
20812
|
+
|
|
20813
|
+
|
|
20814
|
+
|
|
19288
20815
|
|
|
19289
20816
|
|
|
19290
20817
|
|
|
@@ -19454,6 +20981,26 @@ var _TreeMap = class _TreeMap {
|
|
|
19454
20981
|
|
|
19455
20982
|
|
|
19456
20983
|
|
|
20984
|
+
|
|
20985
|
+
|
|
20986
|
+
|
|
20987
|
+
|
|
20988
|
+
|
|
20989
|
+
|
|
20990
|
+
|
|
20991
|
+
|
|
20992
|
+
|
|
20993
|
+
|
|
20994
|
+
|
|
20995
|
+
|
|
20996
|
+
|
|
20997
|
+
|
|
20998
|
+
|
|
20999
|
+
|
|
21000
|
+
|
|
21001
|
+
|
|
21002
|
+
|
|
21003
|
+
|
|
19457
21004
|
|
|
19458
21005
|
|
|
19459
21006
|
|
|
@@ -19627,6 +21174,26 @@ var _TreeMap = class _TreeMap {
|
|
|
19627
21174
|
|
|
19628
21175
|
|
|
19629
21176
|
|
|
21177
|
+
|
|
21178
|
+
|
|
21179
|
+
|
|
21180
|
+
|
|
21181
|
+
|
|
21182
|
+
|
|
21183
|
+
|
|
21184
|
+
|
|
21185
|
+
|
|
21186
|
+
|
|
21187
|
+
|
|
21188
|
+
|
|
21189
|
+
|
|
21190
|
+
|
|
21191
|
+
|
|
21192
|
+
|
|
21193
|
+
|
|
21194
|
+
|
|
21195
|
+
|
|
21196
|
+
|
|
19630
21197
|
|
|
19631
21198
|
|
|
19632
21199
|
|
|
@@ -19797,6 +21364,26 @@ var _TreeMap = class _TreeMap {
|
|
|
19797
21364
|
|
|
19798
21365
|
|
|
19799
21366
|
|
|
21367
|
+
|
|
21368
|
+
|
|
21369
|
+
|
|
21370
|
+
|
|
21371
|
+
|
|
21372
|
+
|
|
21373
|
+
|
|
21374
|
+
|
|
21375
|
+
|
|
21376
|
+
|
|
21377
|
+
|
|
21378
|
+
|
|
21379
|
+
|
|
21380
|
+
|
|
21381
|
+
|
|
21382
|
+
|
|
21383
|
+
|
|
21384
|
+
|
|
21385
|
+
|
|
21386
|
+
|
|
19800
21387
|
|
|
19801
21388
|
|
|
19802
21389
|
|
|
@@ -19970,6 +21557,26 @@ var _TreeMap = class _TreeMap {
|
|
|
19970
21557
|
|
|
19971
21558
|
|
|
19972
21559
|
|
|
21560
|
+
|
|
21561
|
+
|
|
21562
|
+
|
|
21563
|
+
|
|
21564
|
+
|
|
21565
|
+
|
|
21566
|
+
|
|
21567
|
+
|
|
21568
|
+
|
|
21569
|
+
|
|
21570
|
+
|
|
21571
|
+
|
|
21572
|
+
|
|
21573
|
+
|
|
21574
|
+
|
|
21575
|
+
|
|
21576
|
+
|
|
21577
|
+
|
|
21578
|
+
|
|
21579
|
+
|
|
19973
21580
|
|
|
19974
21581
|
|
|
19975
21582
|
|
|
@@ -20143,6 +21750,26 @@ var _TreeMap = class _TreeMap {
|
|
|
20143
21750
|
|
|
20144
21751
|
|
|
20145
21752
|
|
|
21753
|
+
|
|
21754
|
+
|
|
21755
|
+
|
|
21756
|
+
|
|
21757
|
+
|
|
21758
|
+
|
|
21759
|
+
|
|
21760
|
+
|
|
21761
|
+
|
|
21762
|
+
|
|
21763
|
+
|
|
21764
|
+
|
|
21765
|
+
|
|
21766
|
+
|
|
21767
|
+
|
|
21768
|
+
|
|
21769
|
+
|
|
21770
|
+
|
|
21771
|
+
|
|
21772
|
+
|
|
20146
21773
|
|
|
20147
21774
|
|
|
20148
21775
|
|
|
@@ -20319,6 +21946,26 @@ var _TreeMap = class _TreeMap {
|
|
|
20319
21946
|
|
|
20320
21947
|
|
|
20321
21948
|
|
|
21949
|
+
|
|
21950
|
+
|
|
21951
|
+
|
|
21952
|
+
|
|
21953
|
+
|
|
21954
|
+
|
|
21955
|
+
|
|
21956
|
+
|
|
21957
|
+
|
|
21958
|
+
|
|
21959
|
+
|
|
21960
|
+
|
|
21961
|
+
|
|
21962
|
+
|
|
21963
|
+
|
|
21964
|
+
|
|
21965
|
+
|
|
21966
|
+
|
|
21967
|
+
|
|
21968
|
+
|
|
20322
21969
|
|
|
20323
21970
|
|
|
20324
21971
|
|
|
@@ -20495,6 +22142,26 @@ var _TreeMap = class _TreeMap {
|
|
|
20495
22142
|
|
|
20496
22143
|
|
|
20497
22144
|
|
|
22145
|
+
|
|
22146
|
+
|
|
22147
|
+
|
|
22148
|
+
|
|
22149
|
+
|
|
22150
|
+
|
|
22151
|
+
|
|
22152
|
+
|
|
22153
|
+
|
|
22154
|
+
|
|
22155
|
+
|
|
22156
|
+
|
|
22157
|
+
|
|
22158
|
+
|
|
22159
|
+
|
|
22160
|
+
|
|
22161
|
+
|
|
22162
|
+
|
|
22163
|
+
|
|
22164
|
+
|
|
20498
22165
|
|
|
20499
22166
|
|
|
20500
22167
|
|
|
@@ -20665,6 +22332,26 @@ var _TreeMap = class _TreeMap {
|
|
|
20665
22332
|
|
|
20666
22333
|
|
|
20667
22334
|
|
|
22335
|
+
|
|
22336
|
+
|
|
22337
|
+
|
|
22338
|
+
|
|
22339
|
+
|
|
22340
|
+
|
|
22341
|
+
|
|
22342
|
+
|
|
22343
|
+
|
|
22344
|
+
|
|
22345
|
+
|
|
22346
|
+
|
|
22347
|
+
|
|
22348
|
+
|
|
22349
|
+
|
|
22350
|
+
|
|
22351
|
+
|
|
22352
|
+
|
|
22353
|
+
|
|
22354
|
+
|
|
20668
22355
|
|
|
20669
22356
|
|
|
20670
22357
|
|
|
@@ -20837,6 +22524,26 @@ var _TreeMap = class _TreeMap {
|
|
|
20837
22524
|
|
|
20838
22525
|
|
|
20839
22526
|
|
|
22527
|
+
|
|
22528
|
+
|
|
22529
|
+
|
|
22530
|
+
|
|
22531
|
+
|
|
22532
|
+
|
|
22533
|
+
|
|
22534
|
+
|
|
22535
|
+
|
|
22536
|
+
|
|
22537
|
+
|
|
22538
|
+
|
|
22539
|
+
|
|
22540
|
+
|
|
22541
|
+
|
|
22542
|
+
|
|
22543
|
+
|
|
22544
|
+
|
|
22545
|
+
|
|
22546
|
+
|
|
20840
22547
|
|
|
20841
22548
|
|
|
20842
22549
|
|
|
@@ -21010,6 +22717,26 @@ var _TreeMap = class _TreeMap {
|
|
|
21010
22717
|
|
|
21011
22718
|
|
|
21012
22719
|
|
|
22720
|
+
|
|
22721
|
+
|
|
22722
|
+
|
|
22723
|
+
|
|
22724
|
+
|
|
22725
|
+
|
|
22726
|
+
|
|
22727
|
+
|
|
22728
|
+
|
|
22729
|
+
|
|
22730
|
+
|
|
22731
|
+
|
|
22732
|
+
|
|
22733
|
+
|
|
22734
|
+
|
|
22735
|
+
|
|
22736
|
+
|
|
22737
|
+
|
|
22738
|
+
|
|
22739
|
+
|
|
21013
22740
|
|
|
21014
22741
|
|
|
21015
22742
|
|
|
@@ -21184,6 +22911,26 @@ var _TreeMap = class _TreeMap {
|
|
|
21184
22911
|
|
|
21185
22912
|
|
|
21186
22913
|
|
|
22914
|
+
|
|
22915
|
+
|
|
22916
|
+
|
|
22917
|
+
|
|
22918
|
+
|
|
22919
|
+
|
|
22920
|
+
|
|
22921
|
+
|
|
22922
|
+
|
|
22923
|
+
|
|
22924
|
+
|
|
22925
|
+
|
|
22926
|
+
|
|
22927
|
+
|
|
22928
|
+
|
|
22929
|
+
|
|
22930
|
+
|
|
22931
|
+
|
|
22932
|
+
|
|
22933
|
+
|
|
21187
22934
|
|
|
21188
22935
|
|
|
21189
22936
|
|
|
@@ -21353,6 +23100,26 @@ var _TreeMap = class _TreeMap {
|
|
|
21353
23100
|
|
|
21354
23101
|
|
|
21355
23102
|
|
|
23103
|
+
|
|
23104
|
+
|
|
23105
|
+
|
|
23106
|
+
|
|
23107
|
+
|
|
23108
|
+
|
|
23109
|
+
|
|
23110
|
+
|
|
23111
|
+
|
|
23112
|
+
|
|
23113
|
+
|
|
23114
|
+
|
|
23115
|
+
|
|
23116
|
+
|
|
23117
|
+
|
|
23118
|
+
|
|
23119
|
+
|
|
23120
|
+
|
|
23121
|
+
|
|
23122
|
+
|
|
21356
23123
|
|
|
21357
23124
|
|
|
21358
23125
|
|
|
@@ -21416,6 +23183,10 @@ var _TreeMap = class _TreeMap {
|
|
|
21416
23183
|
|
|
21417
23184
|
|
|
21418
23185
|
|
|
23186
|
+
|
|
23187
|
+
|
|
23188
|
+
|
|
23189
|
+
|
|
21419
23190
|
|
|
21420
23191
|
|
|
21421
23192
|
|
|
@@ -21484,6 +23255,10 @@ var _TreeMap = class _TreeMap {
|
|
|
21484
23255
|
|
|
21485
23256
|
|
|
21486
23257
|
|
|
23258
|
+
|
|
23259
|
+
|
|
23260
|
+
|
|
23261
|
+
|
|
21487
23262
|
|
|
21488
23263
|
|
|
21489
23264
|
|
|
@@ -21536,6 +23311,10 @@ var _TreeMap = class _TreeMap {
|
|
|
21536
23311
|
|
|
21537
23312
|
|
|
21538
23313
|
|
|
23314
|
+
|
|
23315
|
+
|
|
23316
|
+
|
|
23317
|
+
|
|
21539
23318
|
|
|
21540
23319
|
|
|
21541
23320
|
|
|
@@ -21592,6 +23371,10 @@ var _TreeMap = class _TreeMap {
|
|
|
21592
23371
|
|
|
21593
23372
|
|
|
21594
23373
|
|
|
23374
|
+
|
|
23375
|
+
|
|
23376
|
+
|
|
23377
|
+
|
|
21595
23378
|
|
|
21596
23379
|
|
|
21597
23380
|
|
|
@@ -21735,6 +23518,22 @@ var _TreeMap = class _TreeMap {
|
|
|
21735
23518
|
|
|
21736
23519
|
|
|
21737
23520
|
|
|
23521
|
+
|
|
23522
|
+
|
|
23523
|
+
|
|
23524
|
+
|
|
23525
|
+
|
|
23526
|
+
|
|
23527
|
+
|
|
23528
|
+
|
|
23529
|
+
|
|
23530
|
+
|
|
23531
|
+
|
|
23532
|
+
|
|
23533
|
+
|
|
23534
|
+
|
|
23535
|
+
|
|
23536
|
+
|
|
21738
23537
|
|
|
21739
23538
|
|
|
21740
23539
|
|
|
@@ -21908,6 +23707,22 @@ var _TreeMap = class _TreeMap {
|
|
|
21908
23707
|
|
|
21909
23708
|
|
|
21910
23709
|
|
|
23710
|
+
|
|
23711
|
+
|
|
23712
|
+
|
|
23713
|
+
|
|
23714
|
+
|
|
23715
|
+
|
|
23716
|
+
|
|
23717
|
+
|
|
23718
|
+
|
|
23719
|
+
|
|
23720
|
+
|
|
23721
|
+
|
|
23722
|
+
|
|
23723
|
+
|
|
23724
|
+
|
|
23725
|
+
|
|
21911
23726
|
|
|
21912
23727
|
|
|
21913
23728
|
|
|
@@ -22065,6 +23880,22 @@ var _TreeMap = class _TreeMap {
|
|
|
22065
23880
|
|
|
22066
23881
|
|
|
22067
23882
|
|
|
23883
|
+
|
|
23884
|
+
|
|
23885
|
+
|
|
23886
|
+
|
|
23887
|
+
|
|
23888
|
+
|
|
23889
|
+
|
|
23890
|
+
|
|
23891
|
+
|
|
23892
|
+
|
|
23893
|
+
|
|
23894
|
+
|
|
23895
|
+
|
|
23896
|
+
|
|
23897
|
+
|
|
23898
|
+
|
|
22068
23899
|
|
|
22069
23900
|
|
|
22070
23901
|
|
|
@@ -22222,6 +24053,22 @@ var _TreeMap = class _TreeMap {
|
|
|
22222
24053
|
|
|
22223
24054
|
|
|
22224
24055
|
|
|
24056
|
+
|
|
24057
|
+
|
|
24058
|
+
|
|
24059
|
+
|
|
24060
|
+
|
|
24061
|
+
|
|
24062
|
+
|
|
24063
|
+
|
|
24064
|
+
|
|
24065
|
+
|
|
24066
|
+
|
|
24067
|
+
|
|
24068
|
+
|
|
24069
|
+
|
|
24070
|
+
|
|
24071
|
+
|
|
22225
24072
|
|
|
22226
24073
|
|
|
22227
24074
|
|
|
@@ -22380,6 +24227,22 @@ var _TreeMap = class _TreeMap {
|
|
|
22380
24227
|
|
|
22381
24228
|
|
|
22382
24229
|
|
|
24230
|
+
|
|
24231
|
+
|
|
24232
|
+
|
|
24233
|
+
|
|
24234
|
+
|
|
24235
|
+
|
|
24236
|
+
|
|
24237
|
+
|
|
24238
|
+
|
|
24239
|
+
|
|
24240
|
+
|
|
24241
|
+
|
|
24242
|
+
|
|
24243
|
+
|
|
24244
|
+
|
|
24245
|
+
|
|
22383
24246
|
|
|
22384
24247
|
|
|
22385
24248
|
|
|
@@ -22487,8 +24350,16 @@ var _TreeMap = class _TreeMap {
|
|
|
22487
24350
|
* Returns keys by rank range (0-indexed, inclusive on both ends).
|
|
22488
24351
|
* @remarks Time O(log n + k). Requires `enableOrderStatistic: true`.
|
|
22489
24352
|
|
|
24353
|
+
|
|
24354
|
+
|
|
24355
|
+
|
|
24356
|
+
|
|
24357
|
+
|
|
24358
|
+
|
|
24359
|
+
|
|
24360
|
+
|
|
22490
24361
|
* @example
|
|
22491
|
-
* // Pagination
|
|
24362
|
+
* // Pagination by position in tree order
|
|
22492
24363
|
* const tree = new TreeMap<number>(
|
|
22493
24364
|
* [10, 20, 30, 40, 50, 60, 70, 80, 90],
|
|
22494
24365
|
* { enableOrderStatistic: true }
|
|
@@ -22647,6 +24518,26 @@ var _TreeMap = class _TreeMap {
|
|
|
22647
24518
|
|
|
22648
24519
|
|
|
22649
24520
|
|
|
24521
|
+
|
|
24522
|
+
|
|
24523
|
+
|
|
24524
|
+
|
|
24525
|
+
|
|
24526
|
+
|
|
24527
|
+
|
|
24528
|
+
|
|
24529
|
+
|
|
24530
|
+
|
|
24531
|
+
|
|
24532
|
+
|
|
24533
|
+
|
|
24534
|
+
|
|
24535
|
+
|
|
24536
|
+
|
|
24537
|
+
|
|
24538
|
+
|
|
24539
|
+
|
|
24540
|
+
|
|
22650
24541
|
|
|
22651
24542
|
|
|
22652
24543
|
|
|
@@ -22774,6 +24665,10 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
22774
24665
|
|
|
22775
24666
|
|
|
22776
24667
|
|
|
24668
|
+
|
|
24669
|
+
|
|
24670
|
+
|
|
24671
|
+
|
|
22777
24672
|
|
|
22778
24673
|
|
|
22779
24674
|
|
|
@@ -22929,6 +24824,26 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
22929
24824
|
|
|
22930
24825
|
|
|
22931
24826
|
|
|
24827
|
+
|
|
24828
|
+
|
|
24829
|
+
|
|
24830
|
+
|
|
24831
|
+
|
|
24832
|
+
|
|
24833
|
+
|
|
24834
|
+
|
|
24835
|
+
|
|
24836
|
+
|
|
24837
|
+
|
|
24838
|
+
|
|
24839
|
+
|
|
24840
|
+
|
|
24841
|
+
|
|
24842
|
+
|
|
24843
|
+
|
|
24844
|
+
|
|
24845
|
+
|
|
24846
|
+
|
|
22932
24847
|
|
|
22933
24848
|
|
|
22934
24849
|
|
|
@@ -23100,6 +25015,26 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
23100
25015
|
|
|
23101
25016
|
|
|
23102
25017
|
|
|
25018
|
+
|
|
25019
|
+
|
|
25020
|
+
|
|
25021
|
+
|
|
25022
|
+
|
|
25023
|
+
|
|
25024
|
+
|
|
25025
|
+
|
|
25026
|
+
|
|
25027
|
+
|
|
25028
|
+
|
|
25029
|
+
|
|
25030
|
+
|
|
25031
|
+
|
|
25032
|
+
|
|
25033
|
+
|
|
25034
|
+
|
|
25035
|
+
|
|
25036
|
+
|
|
25037
|
+
|
|
23103
25038
|
|
|
23104
25039
|
|
|
23105
25040
|
|
|
@@ -23156,6 +25091,10 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
23156
25091
|
|
|
23157
25092
|
|
|
23158
25093
|
|
|
25094
|
+
|
|
25095
|
+
|
|
25096
|
+
|
|
25097
|
+
|
|
23159
25098
|
|
|
23160
25099
|
|
|
23161
25100
|
|
|
@@ -23307,6 +25246,26 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
23307
25246
|
|
|
23308
25247
|
|
|
23309
25248
|
|
|
25249
|
+
|
|
25250
|
+
|
|
25251
|
+
|
|
25252
|
+
|
|
25253
|
+
|
|
25254
|
+
|
|
25255
|
+
|
|
25256
|
+
|
|
25257
|
+
|
|
25258
|
+
|
|
25259
|
+
|
|
25260
|
+
|
|
25261
|
+
|
|
25262
|
+
|
|
25263
|
+
|
|
25264
|
+
|
|
25265
|
+
|
|
25266
|
+
|
|
25267
|
+
|
|
25268
|
+
|
|
23310
25269
|
|
|
23311
25270
|
|
|
23312
25271
|
|
|
@@ -23373,6 +25332,10 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
23373
25332
|
|
|
23374
25333
|
|
|
23375
25334
|
|
|
25335
|
+
|
|
25336
|
+
|
|
25337
|
+
|
|
25338
|
+
|
|
23376
25339
|
|
|
23377
25340
|
|
|
23378
25341
|
|
|
@@ -23542,6 +25505,26 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
23542
25505
|
|
|
23543
25506
|
|
|
23544
25507
|
|
|
25508
|
+
|
|
25509
|
+
|
|
25510
|
+
|
|
25511
|
+
|
|
25512
|
+
|
|
25513
|
+
|
|
25514
|
+
|
|
25515
|
+
|
|
25516
|
+
|
|
25517
|
+
|
|
25518
|
+
|
|
25519
|
+
|
|
25520
|
+
|
|
25521
|
+
|
|
25522
|
+
|
|
25523
|
+
|
|
25524
|
+
|
|
25525
|
+
|
|
25526
|
+
|
|
25527
|
+
|
|
23545
25528
|
|
|
23546
25529
|
|
|
23547
25530
|
|
|
@@ -23609,6 +25592,10 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
23609
25592
|
|
|
23610
25593
|
|
|
23611
25594
|
|
|
25595
|
+
|
|
25596
|
+
|
|
25597
|
+
|
|
25598
|
+
|
|
23612
25599
|
|
|
23613
25600
|
|
|
23614
25601
|
|
|
@@ -23654,6 +25641,10 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
23654
25641
|
|
|
23655
25642
|
|
|
23656
25643
|
|
|
25644
|
+
|
|
25645
|
+
|
|
25646
|
+
|
|
25647
|
+
|
|
23657
25648
|
|
|
23658
25649
|
|
|
23659
25650
|
|
|
@@ -23809,6 +25800,26 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
23809
25800
|
|
|
23810
25801
|
|
|
23811
25802
|
|
|
25803
|
+
|
|
25804
|
+
|
|
25805
|
+
|
|
25806
|
+
|
|
25807
|
+
|
|
25808
|
+
|
|
25809
|
+
|
|
25810
|
+
|
|
25811
|
+
|
|
25812
|
+
|
|
25813
|
+
|
|
25814
|
+
|
|
25815
|
+
|
|
25816
|
+
|
|
25817
|
+
|
|
25818
|
+
|
|
25819
|
+
|
|
25820
|
+
|
|
25821
|
+
|
|
25822
|
+
|
|
23812
25823
|
|
|
23813
25824
|
|
|
23814
25825
|
|
|
@@ -23990,6 +26001,26 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
23990
26001
|
|
|
23991
26002
|
|
|
23992
26003
|
|
|
26004
|
+
|
|
26005
|
+
|
|
26006
|
+
|
|
26007
|
+
|
|
26008
|
+
|
|
26009
|
+
|
|
26010
|
+
|
|
26011
|
+
|
|
26012
|
+
|
|
26013
|
+
|
|
26014
|
+
|
|
26015
|
+
|
|
26016
|
+
|
|
26017
|
+
|
|
26018
|
+
|
|
26019
|
+
|
|
26020
|
+
|
|
26021
|
+
|
|
26022
|
+
|
|
26023
|
+
|
|
23993
26024
|
|
|
23994
26025
|
|
|
23995
26026
|
|
|
@@ -24045,6 +26076,10 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
24045
26076
|
|
|
24046
26077
|
|
|
24047
26078
|
|
|
26079
|
+
|
|
26080
|
+
|
|
26081
|
+
|
|
26082
|
+
|
|
24048
26083
|
|
|
24049
26084
|
|
|
24050
26085
|
|
|
@@ -24084,6 +26119,10 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
24084
26119
|
|
|
24085
26120
|
|
|
24086
26121
|
|
|
26122
|
+
|
|
26123
|
+
|
|
26124
|
+
|
|
26125
|
+
|
|
24087
26126
|
|
|
24088
26127
|
|
|
24089
26128
|
|
|
@@ -24248,6 +26287,26 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
24248
26287
|
|
|
24249
26288
|
|
|
24250
26289
|
|
|
26290
|
+
|
|
26291
|
+
|
|
26292
|
+
|
|
26293
|
+
|
|
26294
|
+
|
|
26295
|
+
|
|
26296
|
+
|
|
26297
|
+
|
|
26298
|
+
|
|
26299
|
+
|
|
26300
|
+
|
|
26301
|
+
|
|
26302
|
+
|
|
26303
|
+
|
|
26304
|
+
|
|
26305
|
+
|
|
26306
|
+
|
|
26307
|
+
|
|
26308
|
+
|
|
26309
|
+
|
|
24251
26310
|
|
|
24252
26311
|
|
|
24253
26312
|
|
|
@@ -24306,6 +26365,10 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
24306
26365
|
|
|
24307
26366
|
|
|
24308
26367
|
|
|
26368
|
+
|
|
26369
|
+
|
|
26370
|
+
|
|
26371
|
+
|
|
24309
26372
|
|
|
24310
26373
|
|
|
24311
26374
|
|
|
@@ -24346,6 +26409,10 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
24346
26409
|
|
|
24347
26410
|
|
|
24348
26411
|
|
|
26412
|
+
|
|
26413
|
+
|
|
26414
|
+
|
|
26415
|
+
|
|
24349
26416
|
|
|
24350
26417
|
|
|
24351
26418
|
|
|
@@ -24386,6 +26453,10 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
24386
26453
|
|
|
24387
26454
|
|
|
24388
26455
|
|
|
26456
|
+
|
|
26457
|
+
|
|
26458
|
+
|
|
26459
|
+
|
|
24389
26460
|
|
|
24390
26461
|
|
|
24391
26462
|
|
|
@@ -24430,6 +26501,10 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
24430
26501
|
|
|
24431
26502
|
|
|
24432
26503
|
|
|
26504
|
+
|
|
26505
|
+
|
|
26506
|
+
|
|
26507
|
+
|
|
24433
26508
|
|
|
24434
26509
|
|
|
24435
26510
|
|
|
@@ -24560,6 +26635,22 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
24560
26635
|
|
|
24561
26636
|
|
|
24562
26637
|
|
|
26638
|
+
|
|
26639
|
+
|
|
26640
|
+
|
|
26641
|
+
|
|
26642
|
+
|
|
26643
|
+
|
|
26644
|
+
|
|
26645
|
+
|
|
26646
|
+
|
|
26647
|
+
|
|
26648
|
+
|
|
26649
|
+
|
|
26650
|
+
|
|
26651
|
+
|
|
26652
|
+
|
|
26653
|
+
|
|
24563
26654
|
|
|
24564
26655
|
|
|
24565
26656
|
|
|
@@ -24701,6 +26792,22 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
24701
26792
|
|
|
24702
26793
|
|
|
24703
26794
|
|
|
26795
|
+
|
|
26796
|
+
|
|
26797
|
+
|
|
26798
|
+
|
|
26799
|
+
|
|
26800
|
+
|
|
26801
|
+
|
|
26802
|
+
|
|
26803
|
+
|
|
26804
|
+
|
|
26805
|
+
|
|
26806
|
+
|
|
26807
|
+
|
|
26808
|
+
|
|
26809
|
+
|
|
26810
|
+
|
|
24704
26811
|
|
|
24705
26812
|
|
|
24706
26813
|
|
|
@@ -24842,6 +26949,22 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
24842
26949
|
|
|
24843
26950
|
|
|
24844
26951
|
|
|
26952
|
+
|
|
26953
|
+
|
|
26954
|
+
|
|
26955
|
+
|
|
26956
|
+
|
|
26957
|
+
|
|
26958
|
+
|
|
26959
|
+
|
|
26960
|
+
|
|
26961
|
+
|
|
26962
|
+
|
|
26963
|
+
|
|
26964
|
+
|
|
26965
|
+
|
|
26966
|
+
|
|
26967
|
+
|
|
24845
26968
|
|
|
24846
26969
|
|
|
24847
26970
|
|
|
@@ -24982,6 +27105,22 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
24982
27105
|
|
|
24983
27106
|
|
|
24984
27107
|
|
|
27108
|
+
|
|
27109
|
+
|
|
27110
|
+
|
|
27111
|
+
|
|
27112
|
+
|
|
27113
|
+
|
|
27114
|
+
|
|
27115
|
+
|
|
27116
|
+
|
|
27117
|
+
|
|
27118
|
+
|
|
27119
|
+
|
|
27120
|
+
|
|
27121
|
+
|
|
27122
|
+
|
|
27123
|
+
|
|
24985
27124
|
|
|
24986
27125
|
|
|
24987
27126
|
|
|
@@ -25152,6 +27291,26 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
25152
27291
|
|
|
25153
27292
|
|
|
25154
27293
|
|
|
27294
|
+
|
|
27295
|
+
|
|
27296
|
+
|
|
27297
|
+
|
|
27298
|
+
|
|
27299
|
+
|
|
27300
|
+
|
|
27301
|
+
|
|
27302
|
+
|
|
27303
|
+
|
|
27304
|
+
|
|
27305
|
+
|
|
27306
|
+
|
|
27307
|
+
|
|
27308
|
+
|
|
27309
|
+
|
|
27310
|
+
|
|
27311
|
+
|
|
27312
|
+
|
|
27313
|
+
|
|
25155
27314
|
|
|
25156
27315
|
|
|
25157
27316
|
|
|
@@ -25328,6 +27487,26 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
25328
27487
|
|
|
25329
27488
|
|
|
25330
27489
|
|
|
27490
|
+
|
|
27491
|
+
|
|
27492
|
+
|
|
27493
|
+
|
|
27494
|
+
|
|
27495
|
+
|
|
27496
|
+
|
|
27497
|
+
|
|
27498
|
+
|
|
27499
|
+
|
|
27500
|
+
|
|
27501
|
+
|
|
27502
|
+
|
|
27503
|
+
|
|
27504
|
+
|
|
27505
|
+
|
|
27506
|
+
|
|
27507
|
+
|
|
27508
|
+
|
|
27509
|
+
|
|
25331
27510
|
|
|
25332
27511
|
|
|
25333
27512
|
|
|
@@ -25511,6 +27690,26 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
25511
27690
|
|
|
25512
27691
|
|
|
25513
27692
|
|
|
27693
|
+
|
|
27694
|
+
|
|
27695
|
+
|
|
27696
|
+
|
|
27697
|
+
|
|
27698
|
+
|
|
27699
|
+
|
|
27700
|
+
|
|
27701
|
+
|
|
27702
|
+
|
|
27703
|
+
|
|
27704
|
+
|
|
27705
|
+
|
|
27706
|
+
|
|
27707
|
+
|
|
27708
|
+
|
|
27709
|
+
|
|
27710
|
+
|
|
27711
|
+
|
|
27712
|
+
|
|
25514
27713
|
|
|
25515
27714
|
|
|
25516
27715
|
|
|
@@ -25689,6 +27888,26 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
25689
27888
|
|
|
25690
27889
|
|
|
25691
27890
|
|
|
27891
|
+
|
|
27892
|
+
|
|
27893
|
+
|
|
27894
|
+
|
|
27895
|
+
|
|
27896
|
+
|
|
27897
|
+
|
|
27898
|
+
|
|
27899
|
+
|
|
27900
|
+
|
|
27901
|
+
|
|
27902
|
+
|
|
27903
|
+
|
|
27904
|
+
|
|
27905
|
+
|
|
27906
|
+
|
|
27907
|
+
|
|
27908
|
+
|
|
27909
|
+
|
|
27910
|
+
|
|
25692
27911
|
|
|
25693
27912
|
|
|
25694
27913
|
|
|
@@ -25919,8 +28138,16 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
25919
28138
|
/**
|
|
25920
28139
|
* Get elements by rank range
|
|
25921
28140
|
|
|
28141
|
+
|
|
28142
|
+
|
|
28143
|
+
|
|
28144
|
+
|
|
28145
|
+
|
|
28146
|
+
|
|
28147
|
+
|
|
28148
|
+
|
|
25922
28149
|
* @example
|
|
25923
|
-
* // Pagination
|
|
28150
|
+
* // Pagination by position in tree order
|
|
25924
28151
|
* const tree = new TreeMultiSet<number>(
|
|
25925
28152
|
* [10, 20, 30, 40, 50, 60, 70, 80, 90],
|
|
25926
28153
|
* { enableOrderStatistic: true }
|
|
@@ -25942,6 +28169,26 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
25942
28169
|
|
|
25943
28170
|
|
|
25944
28171
|
|
|
28172
|
+
|
|
28173
|
+
|
|
28174
|
+
|
|
28175
|
+
|
|
28176
|
+
|
|
28177
|
+
|
|
28178
|
+
|
|
28179
|
+
|
|
28180
|
+
|
|
28181
|
+
|
|
28182
|
+
|
|
28183
|
+
|
|
28184
|
+
|
|
28185
|
+
|
|
28186
|
+
|
|
28187
|
+
|
|
28188
|
+
|
|
28189
|
+
|
|
28190
|
+
|
|
28191
|
+
|
|
25945
28192
|
|
|
25946
28193
|
* @example
|
|
25947
28194
|
* // Deep clone
|
|
@@ -26074,6 +28321,22 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
26074
28321
|
|
|
26075
28322
|
|
|
26076
28323
|
|
|
28324
|
+
|
|
28325
|
+
|
|
28326
|
+
|
|
28327
|
+
|
|
28328
|
+
|
|
28329
|
+
|
|
28330
|
+
|
|
28331
|
+
|
|
28332
|
+
|
|
28333
|
+
|
|
28334
|
+
|
|
28335
|
+
|
|
28336
|
+
|
|
28337
|
+
|
|
28338
|
+
|
|
28339
|
+
|
|
26077
28340
|
|
|
26078
28341
|
|
|
26079
28342
|
|
|
@@ -26245,6 +28508,26 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
26245
28508
|
|
|
26246
28509
|
|
|
26247
28510
|
|
|
28511
|
+
|
|
28512
|
+
|
|
28513
|
+
|
|
28514
|
+
|
|
28515
|
+
|
|
28516
|
+
|
|
28517
|
+
|
|
28518
|
+
|
|
28519
|
+
|
|
28520
|
+
|
|
28521
|
+
|
|
28522
|
+
|
|
28523
|
+
|
|
28524
|
+
|
|
28525
|
+
|
|
28526
|
+
|
|
28527
|
+
|
|
28528
|
+
|
|
28529
|
+
|
|
28530
|
+
|
|
26248
28531
|
|
|
26249
28532
|
|
|
26250
28533
|
|