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
|
@@ -797,6 +797,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
797
797
|
|
|
798
798
|
|
|
799
799
|
|
|
800
|
+
|
|
801
|
+
|
|
802
|
+
|
|
803
|
+
|
|
800
804
|
|
|
801
805
|
|
|
802
806
|
|
|
@@ -847,6 +851,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
847
851
|
|
|
848
852
|
|
|
849
853
|
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
|
|
857
|
+
|
|
850
858
|
|
|
851
859
|
|
|
852
860
|
|
|
@@ -861,6 +869,14 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
861
869
|
get first() {
|
|
862
870
|
return this.length > 0 ? this.elements[this._offset] : void 0;
|
|
863
871
|
}
|
|
872
|
+
/**
|
|
873
|
+
* Peek at the front element without removing it (alias for `first`).
|
|
874
|
+
* @remarks Time O(1), Space O(1)
|
|
875
|
+
* @returns Front element or undefined.
|
|
876
|
+
*/
|
|
877
|
+
peek() {
|
|
878
|
+
return this.first;
|
|
879
|
+
}
|
|
864
880
|
/**
|
|
865
881
|
* Get the last element (back) without removing it.
|
|
866
882
|
* @remarks Time O(1), Space O(1)
|
|
@@ -913,6 +929,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
913
929
|
|
|
914
930
|
|
|
915
931
|
|
|
932
|
+
|
|
933
|
+
|
|
934
|
+
|
|
935
|
+
|
|
916
936
|
|
|
917
937
|
|
|
918
938
|
|
|
@@ -975,6 +995,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
975
995
|
|
|
976
996
|
|
|
977
997
|
|
|
998
|
+
|
|
999
|
+
|
|
1000
|
+
|
|
1001
|
+
|
|
978
1002
|
|
|
979
1003
|
|
|
980
1004
|
|
|
@@ -1044,6 +1068,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1044
1068
|
|
|
1045
1069
|
|
|
1046
1070
|
|
|
1071
|
+
|
|
1072
|
+
|
|
1073
|
+
|
|
1074
|
+
|
|
1047
1075
|
|
|
1048
1076
|
|
|
1049
1077
|
|
|
@@ -1103,6 +1131,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1103
1131
|
|
|
1104
1132
|
|
|
1105
1133
|
|
|
1134
|
+
|
|
1135
|
+
|
|
1136
|
+
|
|
1137
|
+
|
|
1106
1138
|
|
|
1107
1139
|
|
|
1108
1140
|
|
|
@@ -1155,6 +1187,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1155
1187
|
|
|
1156
1188
|
|
|
1157
1189
|
|
|
1190
|
+
|
|
1191
|
+
|
|
1192
|
+
|
|
1193
|
+
|
|
1158
1194
|
|
|
1159
1195
|
|
|
1160
1196
|
|
|
@@ -1206,6 +1242,21 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1206
1242
|
this._elements[this._offset + index] = newElement;
|
|
1207
1243
|
return true;
|
|
1208
1244
|
}
|
|
1245
|
+
/**
|
|
1246
|
+
* Delete the first element that satisfies a predicate.
|
|
1247
|
+
* @remarks Time O(N), Space O(N)
|
|
1248
|
+
* @param predicate - Function (value, index, queue) → boolean to decide deletion.
|
|
1249
|
+
* @returns True if a match was removed.
|
|
1250
|
+
*/
|
|
1251
|
+
deleteWhere(predicate) {
|
|
1252
|
+
for (let i = 0; i < this.length; i++) {
|
|
1253
|
+
if (predicate(this._elements[this._offset + i], i, this)) {
|
|
1254
|
+
this.deleteAt(i);
|
|
1255
|
+
return true;
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
return false;
|
|
1259
|
+
}
|
|
1209
1260
|
/**
|
|
1210
1261
|
* Reverse the queue in-place by compacting then reversing.
|
|
1211
1262
|
* @remarks Time O(N), Space O(N)
|
|
@@ -1248,6 +1299,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1248
1299
|
|
|
1249
1300
|
|
|
1250
1301
|
|
|
1302
|
+
|
|
1303
|
+
|
|
1304
|
+
|
|
1305
|
+
|
|
1251
1306
|
|
|
1252
1307
|
|
|
1253
1308
|
|
|
@@ -1294,6 +1349,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1294
1349
|
|
|
1295
1350
|
|
|
1296
1351
|
|
|
1352
|
+
|
|
1353
|
+
|
|
1354
|
+
|
|
1355
|
+
|
|
1297
1356
|
|
|
1298
1357
|
|
|
1299
1358
|
|
|
@@ -1363,6 +1422,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1363
1422
|
|
|
1364
1423
|
|
|
1365
1424
|
|
|
1425
|
+
|
|
1426
|
+
|
|
1427
|
+
|
|
1428
|
+
|
|
1366
1429
|
|
|
1367
1430
|
|
|
1368
1431
|
|
|
@@ -1416,6 +1479,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1416
1479
|
|
|
1417
1480
|
|
|
1418
1481
|
|
|
1482
|
+
|
|
1483
|
+
|
|
1484
|
+
|
|
1485
|
+
|
|
1419
1486
|
|
|
1420
1487
|
|
|
1421
1488
|
|
|
@@ -1473,6 +1540,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1473
1540
|
|
|
1474
1541
|
|
|
1475
1542
|
|
|
1543
|
+
|
|
1544
|
+
|
|
1545
|
+
|
|
1546
|
+
|
|
1476
1547
|
|
|
1477
1548
|
|
|
1478
1549
|
|
|
@@ -1952,7 +2023,7 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
1952
2023
|
}
|
|
1953
2024
|
/**
|
|
1954
2025
|
* Adds a new node to the tree.
|
|
1955
|
-
* @remarks Time O(
|
|
2026
|
+
* @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).
|
|
1956
2027
|
*
|
|
1957
2028
|
* @param keyNodeOrEntry - The key, node, or entry to add.
|
|
1958
2029
|
* @returns True if the addition was successful, false otherwise.
|
|
@@ -1981,6 +2052,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
1981
2052
|
|
|
1982
2053
|
|
|
1983
2054
|
|
|
2055
|
+
|
|
2056
|
+
|
|
2057
|
+
|
|
2058
|
+
|
|
1984
2059
|
|
|
1985
2060
|
|
|
1986
2061
|
|
|
@@ -2000,7 +2075,7 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2000
2075
|
}
|
|
2001
2076
|
/**
|
|
2002
2077
|
* Adds or updates a new node to the tree.
|
|
2003
|
-
* @remarks Time O(
|
|
2078
|
+
* @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).
|
|
2004
2079
|
*
|
|
2005
2080
|
* @param keyNodeOrEntry - The key, node, or entry to set or update.
|
|
2006
2081
|
* @param [value] - The value, if providing just a key.
|
|
@@ -2035,6 +2110,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2035
2110
|
|
|
2036
2111
|
|
|
2037
2112
|
|
|
2113
|
+
|
|
2114
|
+
|
|
2115
|
+
|
|
2116
|
+
|
|
2038
2117
|
|
|
2039
2118
|
|
|
2040
2119
|
|
|
@@ -2141,6 +2220,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2141
2220
|
|
|
2142
2221
|
|
|
2143
2222
|
|
|
2223
|
+
|
|
2224
|
+
|
|
2225
|
+
|
|
2226
|
+
|
|
2144
2227
|
|
|
2145
2228
|
|
|
2146
2229
|
|
|
@@ -2183,6 +2266,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2183
2266
|
|
|
2184
2267
|
|
|
2185
2268
|
|
|
2269
|
+
|
|
2270
|
+
|
|
2271
|
+
|
|
2272
|
+
|
|
2186
2273
|
|
|
2187
2274
|
|
|
2188
2275
|
|
|
@@ -2246,6 +2333,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2246
2333
|
|
|
2247
2334
|
|
|
2248
2335
|
|
|
2336
|
+
|
|
2337
|
+
|
|
2338
|
+
|
|
2339
|
+
|
|
2249
2340
|
|
|
2250
2341
|
|
|
2251
2342
|
|
|
@@ -2262,22 +2353,66 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2262
2353
|
this.setMany(anotherTree, []);
|
|
2263
2354
|
}
|
|
2264
2355
|
/**
|
|
2265
|
-
*
|
|
2266
|
-
* @remarks Time O(N)
|
|
2356
|
+
* Deletes a node from the tree (internal, returns balancing metadata).
|
|
2357
|
+
* @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).
|
|
2358
|
+
* @internal Used by AVL/BST subclasses that need balancing metadata after deletion.
|
|
2267
2359
|
*
|
|
2268
|
-
* @param
|
|
2269
|
-
* @
|
|
2360
|
+
* @param keyNodeEntryRawOrPredicate - The node to delete.
|
|
2361
|
+
* @returns An array containing deletion results with balancing metadata.
|
|
2270
2362
|
*/
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
this.
|
|
2363
|
+
_deleteInternal(keyNodeEntryRawOrPredicate) {
|
|
2364
|
+
const deletedResult = [];
|
|
2365
|
+
if (!this._root) return deletedResult;
|
|
2366
|
+
const curr = this.getNode(keyNodeEntryRawOrPredicate);
|
|
2367
|
+
if (!curr) return deletedResult;
|
|
2368
|
+
const parent = curr == null ? void 0 : curr.parent;
|
|
2369
|
+
let needBalanced;
|
|
2370
|
+
let orgCurrent = curr;
|
|
2371
|
+
if (!curr.left && !curr.right && !parent) {
|
|
2372
|
+
this._setRoot(void 0);
|
|
2373
|
+
} else if (curr.left) {
|
|
2374
|
+
const leftSubTreeRightMost = this.getRightMost((node) => node, curr.left);
|
|
2375
|
+
if (leftSubTreeRightMost) {
|
|
2376
|
+
const parentOfLeftSubTreeMax = leftSubTreeRightMost.parent;
|
|
2377
|
+
orgCurrent = this._swapProperties(curr, leftSubTreeRightMost);
|
|
2378
|
+
if (this._isMapMode) {
|
|
2379
|
+
this._store.set(curr.key, curr);
|
|
2380
|
+
this._store.set(leftSubTreeRightMost.key, leftSubTreeRightMost);
|
|
2381
|
+
}
|
|
2382
|
+
if (parentOfLeftSubTreeMax) {
|
|
2383
|
+
if (parentOfLeftSubTreeMax.right === leftSubTreeRightMost)
|
|
2384
|
+
parentOfLeftSubTreeMax.right = leftSubTreeRightMost.left;
|
|
2385
|
+
else parentOfLeftSubTreeMax.left = leftSubTreeRightMost.left;
|
|
2386
|
+
needBalanced = parentOfLeftSubTreeMax;
|
|
2387
|
+
}
|
|
2388
|
+
}
|
|
2389
|
+
} else if (parent) {
|
|
2390
|
+
const { familyPosition: fp } = curr;
|
|
2391
|
+
if (fp === "LEFT" || fp === "ROOT_LEFT") {
|
|
2392
|
+
parent.left = curr.right;
|
|
2393
|
+
} else if (fp === "RIGHT" || fp === "ROOT_RIGHT") {
|
|
2394
|
+
parent.right = curr.right;
|
|
2395
|
+
}
|
|
2396
|
+
needBalanced = parent;
|
|
2397
|
+
} else {
|
|
2398
|
+
this._setRoot(curr.right);
|
|
2399
|
+
curr.right = void 0;
|
|
2400
|
+
}
|
|
2401
|
+
this._size = this._size - 1;
|
|
2402
|
+
deletedResult.push({ deleted: orgCurrent, needBalanced });
|
|
2403
|
+
if (this._isMapMode && orgCurrent) this._store.delete(orgCurrent.key);
|
|
2404
|
+
return deletedResult;
|
|
2274
2405
|
}
|
|
2275
2406
|
/**
|
|
2276
2407
|
* Deletes a node from the tree.
|
|
2277
|
-
* @remarks Time O(
|
|
2408
|
+
* @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).
|
|
2278
2409
|
*
|
|
2279
2410
|
* @param keyNodeEntryRawOrPredicate - The node to delete.
|
|
2280
|
-
* @returns
|
|
2411
|
+
* @returns True if the node was found and deleted, false otherwise.
|
|
2412
|
+
|
|
2413
|
+
|
|
2414
|
+
|
|
2415
|
+
|
|
2281
2416
|
|
|
2282
2417
|
|
|
2283
2418
|
|
|
@@ -2321,51 +2456,11 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2321
2456
|
* console.log(tree.size); // 4;
|
|
2322
2457
|
*/
|
|
2323
2458
|
delete(keyNodeEntryRawOrPredicate) {
|
|
2324
|
-
|
|
2325
|
-
if (!this._root) return deletedResult;
|
|
2326
|
-
const curr = this.getNode(keyNodeEntryRawOrPredicate);
|
|
2327
|
-
if (!curr) return deletedResult;
|
|
2328
|
-
const parent = curr == null ? void 0 : curr.parent;
|
|
2329
|
-
let needBalanced;
|
|
2330
|
-
let orgCurrent = curr;
|
|
2331
|
-
if (!curr.left && !curr.right && !parent) {
|
|
2332
|
-
this._setRoot(void 0);
|
|
2333
|
-
} else if (curr.left) {
|
|
2334
|
-
const leftSubTreeRightMost = this.getRightMost((node) => node, curr.left);
|
|
2335
|
-
if (leftSubTreeRightMost) {
|
|
2336
|
-
const parentOfLeftSubTreeMax = leftSubTreeRightMost.parent;
|
|
2337
|
-
orgCurrent = this._swapProperties(curr, leftSubTreeRightMost);
|
|
2338
|
-
if (this._isMapMode) {
|
|
2339
|
-
this._store.set(curr.key, curr);
|
|
2340
|
-
this._store.set(leftSubTreeRightMost.key, leftSubTreeRightMost);
|
|
2341
|
-
}
|
|
2342
|
-
if (parentOfLeftSubTreeMax) {
|
|
2343
|
-
if (parentOfLeftSubTreeMax.right === leftSubTreeRightMost)
|
|
2344
|
-
parentOfLeftSubTreeMax.right = leftSubTreeRightMost.left;
|
|
2345
|
-
else parentOfLeftSubTreeMax.left = leftSubTreeRightMost.left;
|
|
2346
|
-
needBalanced = parentOfLeftSubTreeMax;
|
|
2347
|
-
}
|
|
2348
|
-
}
|
|
2349
|
-
} else if (parent) {
|
|
2350
|
-
const { familyPosition: fp } = curr;
|
|
2351
|
-
if (fp === "LEFT" || fp === "ROOT_LEFT") {
|
|
2352
|
-
parent.left = curr.right;
|
|
2353
|
-
} else if (fp === "RIGHT" || fp === "ROOT_RIGHT") {
|
|
2354
|
-
parent.right = curr.right;
|
|
2355
|
-
}
|
|
2356
|
-
needBalanced = parent;
|
|
2357
|
-
} else {
|
|
2358
|
-
this._setRoot(curr.right);
|
|
2359
|
-
curr.right = void 0;
|
|
2360
|
-
}
|
|
2361
|
-
this._size = this._size - 1;
|
|
2362
|
-
deletedResult.push({ deleted: orgCurrent, needBalanced });
|
|
2363
|
-
if (this._isMapMode && orgCurrent) this._store.delete(orgCurrent.key);
|
|
2364
|
-
return deletedResult;
|
|
2459
|
+
return this._deleteInternal(keyNodeEntryRawOrPredicate).length > 0;
|
|
2365
2460
|
}
|
|
2366
2461
|
/**
|
|
2367
2462
|
* Searches the tree for nodes matching a predicate.
|
|
2368
|
-
* @remarks Time O(
|
|
2463
|
+
* @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).
|
|
2369
2464
|
*
|
|
2370
2465
|
* @template C - The type of the callback function.
|
|
2371
2466
|
* @param keyNodeEntryOrPredicate - The key, node, entry, or predicate function to search for.
|
|
@@ -2414,7 +2509,7 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2414
2509
|
}
|
|
2415
2510
|
/**
|
|
2416
2511
|
* Gets the first node matching a predicate.
|
|
2417
|
-
* @remarks Time O(
|
|
2512
|
+
* @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.
|
|
2418
2513
|
*
|
|
2419
2514
|
* @param keyNodeEntryOrPredicate - The key, node, entry, or predicate function to search for.
|
|
2420
2515
|
* @param [startNode=this._root] - The node to start the search from.
|
|
@@ -2448,6 +2543,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2448
2543
|
|
|
2449
2544
|
|
|
2450
2545
|
|
|
2546
|
+
|
|
2547
|
+
|
|
2548
|
+
|
|
2549
|
+
|
|
2451
2550
|
|
|
2452
2551
|
|
|
2453
2552
|
|
|
@@ -2470,7 +2569,7 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2470
2569
|
}
|
|
2471
2570
|
/**
|
|
2472
2571
|
* Gets the value associated with a key.
|
|
2473
|
-
* @remarks Time O(
|
|
2572
|
+
* @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).
|
|
2474
2573
|
*
|
|
2475
2574
|
* @param keyNodeEntryOrPredicate - The key, node, or entry to get the value for.
|
|
2476
2575
|
* @param [startNode=this._root] - The node to start searching from (if not in Map mode).
|
|
@@ -2506,6 +2605,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2506
2605
|
|
|
2507
2606
|
|
|
2508
2607
|
|
|
2608
|
+
|
|
2609
|
+
|
|
2610
|
+
|
|
2611
|
+
|
|
2509
2612
|
|
|
2510
2613
|
|
|
2511
2614
|
|
|
@@ -2567,6 +2670,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2567
2670
|
|
|
2568
2671
|
|
|
2569
2672
|
|
|
2673
|
+
|
|
2674
|
+
|
|
2675
|
+
|
|
2676
|
+
|
|
2570
2677
|
|
|
2571
2678
|
|
|
2572
2679
|
|
|
@@ -2615,6 +2722,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2615
2722
|
|
|
2616
2723
|
|
|
2617
2724
|
|
|
2725
|
+
|
|
2726
|
+
|
|
2727
|
+
|
|
2728
|
+
|
|
2618
2729
|
|
|
2619
2730
|
|
|
2620
2731
|
|
|
@@ -2672,6 +2783,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2672
2783
|
|
|
2673
2784
|
|
|
2674
2785
|
|
|
2786
|
+
|
|
2787
|
+
|
|
2788
|
+
|
|
2789
|
+
|
|
2675
2790
|
|
|
2676
2791
|
|
|
2677
2792
|
|
|
@@ -2756,6 +2871,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2756
2871
|
|
|
2757
2872
|
|
|
2758
2873
|
|
|
2874
|
+
|
|
2875
|
+
|
|
2876
|
+
|
|
2877
|
+
|
|
2759
2878
|
|
|
2760
2879
|
|
|
2761
2880
|
|
|
@@ -2817,6 +2936,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2817
2936
|
|
|
2818
2937
|
|
|
2819
2938
|
|
|
2939
|
+
|
|
2940
|
+
|
|
2941
|
+
|
|
2942
|
+
|
|
2820
2943
|
|
|
2821
2944
|
|
|
2822
2945
|
|
|
@@ -3294,6 +3417,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
3294
3417
|
|
|
3295
3418
|
|
|
3296
3419
|
|
|
3420
|
+
|
|
3421
|
+
|
|
3422
|
+
|
|
3423
|
+
|
|
3297
3424
|
|
|
3298
3425
|
|
|
3299
3426
|
|
|
@@ -3346,6 +3473,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
3346
3473
|
|
|
3347
3474
|
|
|
3348
3475
|
|
|
3476
|
+
|
|
3477
|
+
|
|
3478
|
+
|
|
3479
|
+
|
|
3349
3480
|
|
|
3350
3481
|
|
|
3351
3482
|
|
|
@@ -3402,6 +3533,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
3402
3533
|
|
|
3403
3534
|
|
|
3404
3535
|
|
|
3536
|
+
|
|
3537
|
+
|
|
3538
|
+
|
|
3539
|
+
|
|
3405
3540
|
|
|
3406
3541
|
|
|
3407
3542
|
|
|
@@ -3483,6 +3618,10 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
3483
3618
|
|
|
3484
3619
|
|
|
3485
3620
|
|
|
3621
|
+
|
|
3622
|
+
|
|
3623
|
+
|
|
3624
|
+
|
|
3486
3625
|
|
|
3487
3626
|
|
|
3488
3627
|
|
|
@@ -4295,6 +4434,14 @@ var _BST = class _BST extends BinaryTree {
|
|
|
4295
4434
|
|
|
4296
4435
|
|
|
4297
4436
|
|
|
4437
|
+
|
|
4438
|
+
|
|
4439
|
+
|
|
4440
|
+
|
|
4441
|
+
|
|
4442
|
+
|
|
4443
|
+
|
|
4444
|
+
|
|
4298
4445
|
|
|
4299
4446
|
|
|
4300
4447
|
|
|
@@ -4629,6 +4776,18 @@ var _BST = class _BST extends BinaryTree {
|
|
|
4629
4776
|
|
|
4630
4777
|
|
|
4631
4778
|
|
|
4779
|
+
|
|
4780
|
+
|
|
4781
|
+
|
|
4782
|
+
|
|
4783
|
+
|
|
4784
|
+
|
|
4785
|
+
|
|
4786
|
+
|
|
4787
|
+
|
|
4788
|
+
|
|
4789
|
+
|
|
4790
|
+
|
|
4632
4791
|
|
|
4633
4792
|
|
|
4634
4793
|
|
|
@@ -4748,6 +4907,14 @@ var _BST = class _BST extends BinaryTree {
|
|
|
4748
4907
|
|
|
4749
4908
|
|
|
4750
4909
|
|
|
4910
|
+
|
|
4911
|
+
|
|
4912
|
+
|
|
4913
|
+
|
|
4914
|
+
|
|
4915
|
+
|
|
4916
|
+
|
|
4917
|
+
|
|
4751
4918
|
|
|
4752
4919
|
|
|
4753
4920
|
|
|
@@ -5039,6 +5206,10 @@ var _BST = class _BST extends BinaryTree {
|
|
|
5039
5206
|
|
|
5040
5207
|
|
|
5041
5208
|
|
|
5209
|
+
|
|
5210
|
+
|
|
5211
|
+
|
|
5212
|
+
|
|
5042
5213
|
|
|
5043
5214
|
|
|
5044
5215
|
|
|
@@ -5108,6 +5279,10 @@ var _BST = class _BST extends BinaryTree {
|
|
|
5108
5279
|
|
|
5109
5280
|
|
|
5110
5281
|
|
|
5282
|
+
|
|
5283
|
+
|
|
5284
|
+
|
|
5285
|
+
|
|
5111
5286
|
|
|
5112
5287
|
|
|
5113
5288
|
|
|
@@ -5226,6 +5401,14 @@ var _BST = class _BST extends BinaryTree {
|
|
|
5226
5401
|
|
|
5227
5402
|
|
|
5228
5403
|
|
|
5404
|
+
|
|
5405
|
+
|
|
5406
|
+
|
|
5407
|
+
|
|
5408
|
+
|
|
5409
|
+
|
|
5410
|
+
|
|
5411
|
+
|
|
5229
5412
|
|
|
5230
5413
|
|
|
5231
5414
|
|
|
@@ -5287,12 +5470,11 @@ var _BST = class _BST extends BinaryTree {
|
|
|
5287
5470
|
*/
|
|
5288
5471
|
deleteWhere(keyNodeEntryOrPredicate, onlyOne = false, startNode = this._root, iterationType = this.iterationType) {
|
|
5289
5472
|
const toDelete = this.search(keyNodeEntryOrPredicate, onlyOne, (node) => node, startNode, iterationType);
|
|
5290
|
-
let
|
|
5473
|
+
let deleted = false;
|
|
5291
5474
|
for (const node of toDelete) {
|
|
5292
|
-
|
|
5293
|
-
results = results.concat(deleteInfo);
|
|
5475
|
+
if (this.delete(node)) deleted = true;
|
|
5294
5476
|
}
|
|
5295
|
-
return
|
|
5477
|
+
return deleted;
|
|
5296
5478
|
}
|
|
5297
5479
|
/**
|
|
5298
5480
|
* (Protected) Creates the default comparator function for keys that don't have a custom comparator.
|
|
@@ -5921,6 +6103,14 @@ var _BinaryIndexedTree = class _BinaryIndexedTree {
|
|
|
5921
6103
|
|
|
5922
6104
|
|
|
5923
6105
|
|
|
6106
|
+
|
|
6107
|
+
|
|
6108
|
+
|
|
6109
|
+
|
|
6110
|
+
|
|
6111
|
+
|
|
6112
|
+
|
|
6113
|
+
|
|
5924
6114
|
|
|
5925
6115
|
|
|
5926
6116
|
|
|
@@ -5997,6 +6187,14 @@ var _BinaryIndexedTree = class _BinaryIndexedTree {
|
|
|
5997
6187
|
|
|
5998
6188
|
|
|
5999
6189
|
|
|
6190
|
+
|
|
6191
|
+
|
|
6192
|
+
|
|
6193
|
+
|
|
6194
|
+
|
|
6195
|
+
|
|
6196
|
+
|
|
6197
|
+
|
|
6000
6198
|
|
|
6001
6199
|
|
|
6002
6200
|
|
|
@@ -6073,6 +6271,14 @@ var _BinaryIndexedTree = class _BinaryIndexedTree {
|
|
|
6073
6271
|
|
|
6074
6272
|
|
|
6075
6273
|
|
|
6274
|
+
|
|
6275
|
+
|
|
6276
|
+
|
|
6277
|
+
|
|
6278
|
+
|
|
6279
|
+
|
|
6280
|
+
|
|
6281
|
+
|
|
6076
6282
|
|
|
6077
6283
|
|
|
6078
6284
|
|
|
@@ -6149,6 +6355,14 @@ var _BinaryIndexedTree = class _BinaryIndexedTree {
|
|
|
6149
6355
|
|
|
6150
6356
|
|
|
6151
6357
|
|
|
6358
|
+
|
|
6359
|
+
|
|
6360
|
+
|
|
6361
|
+
|
|
6362
|
+
|
|
6363
|
+
|
|
6364
|
+
|
|
6365
|
+
|
|
6152
6366
|
|
|
6153
6367
|
|
|
6154
6368
|
|
|
@@ -6223,6 +6437,14 @@ var _BinaryIndexedTree = class _BinaryIndexedTree {
|
|
|
6223
6437
|
|
|
6224
6438
|
|
|
6225
6439
|
|
|
6440
|
+
|
|
6441
|
+
|
|
6442
|
+
|
|
6443
|
+
|
|
6444
|
+
|
|
6445
|
+
|
|
6446
|
+
|
|
6447
|
+
|
|
6226
6448
|
|
|
6227
6449
|
|
|
6228
6450
|
|
|
@@ -6304,6 +6526,14 @@ var _BinaryIndexedTree = class _BinaryIndexedTree {
|
|
|
6304
6526
|
|
|
6305
6527
|
|
|
6306
6528
|
|
|
6529
|
+
|
|
6530
|
+
|
|
6531
|
+
|
|
6532
|
+
|
|
6533
|
+
|
|
6534
|
+
|
|
6535
|
+
|
|
6536
|
+
|
|
6307
6537
|
|
|
6308
6538
|
|
|
6309
6539
|
|
|
@@ -6358,6 +6588,10 @@ var _BinaryIndexedTree = class _BinaryIndexedTree {
|
|
|
6358
6588
|
|
|
6359
6589
|
|
|
6360
6590
|
|
|
6591
|
+
|
|
6592
|
+
|
|
6593
|
+
|
|
6594
|
+
|
|
6361
6595
|
|
|
6362
6596
|
|
|
6363
6597
|
|
|
@@ -6419,6 +6653,10 @@ var _BinaryIndexedTree = class _BinaryIndexedTree {
|
|
|
6419
6653
|
|
|
6420
6654
|
|
|
6421
6655
|
|
|
6656
|
+
|
|
6657
|
+
|
|
6658
|
+
|
|
6659
|
+
|
|
6422
6660
|
|
|
6423
6661
|
|
|
6424
6662
|
|
|
@@ -6582,6 +6820,10 @@ var _SegmentTree = class _SegmentTree {
|
|
|
6582
6820
|
|
|
6583
6821
|
|
|
6584
6822
|
|
|
6823
|
+
|
|
6824
|
+
|
|
6825
|
+
|
|
6826
|
+
|
|
6585
6827
|
|
|
6586
6828
|
|
|
6587
6829
|
|
|
@@ -6654,6 +6896,10 @@ var _SegmentTree = class _SegmentTree {
|
|
|
6654
6896
|
|
|
6655
6897
|
|
|
6656
6898
|
|
|
6899
|
+
|
|
6900
|
+
|
|
6901
|
+
|
|
6902
|
+
|
|
6657
6903
|
|
|
6658
6904
|
|
|
6659
6905
|
|
|
@@ -6720,6 +6966,10 @@ var _SegmentTree = class _SegmentTree {
|
|
|
6720
6966
|
|
|
6721
6967
|
|
|
6722
6968
|
|
|
6969
|
+
|
|
6970
|
+
|
|
6971
|
+
|
|
6972
|
+
|
|
6723
6973
|
|
|
6724
6974
|
|
|
6725
6975
|
|
|
@@ -6793,6 +7043,10 @@ var _SegmentTree = class _SegmentTree {
|
|
|
6793
7043
|
|
|
6794
7044
|
|
|
6795
7045
|
|
|
7046
|
+
|
|
7047
|
+
|
|
7048
|
+
|
|
7049
|
+
|
|
6796
7050
|
|
|
6797
7051
|
|
|
6798
7052
|
|
|
@@ -6844,6 +7098,10 @@ var _SegmentTree = class _SegmentTree {
|
|
|
6844
7098
|
|
|
6845
7099
|
|
|
6846
7100
|
|
|
7101
|
+
|
|
7102
|
+
|
|
7103
|
+
|
|
7104
|
+
|
|
6847
7105
|
|
|
6848
7106
|
|
|
6849
7107
|
|
|
@@ -6921,6 +7179,10 @@ var _SegmentTree = class _SegmentTree {
|
|
|
6921
7179
|
|
|
6922
7180
|
|
|
6923
7181
|
|
|
7182
|
+
|
|
7183
|
+
|
|
7184
|
+
|
|
7185
|
+
|
|
6924
7186
|
|
|
6925
7187
|
|
|
6926
7188
|
|
|
@@ -7304,6 +7566,22 @@ var _AVLTree = class _AVLTree extends BST {
|
|
|
7304
7566
|
|
|
7305
7567
|
|
|
7306
7568
|
|
|
7569
|
+
|
|
7570
|
+
|
|
7571
|
+
|
|
7572
|
+
|
|
7573
|
+
|
|
7574
|
+
|
|
7575
|
+
|
|
7576
|
+
|
|
7577
|
+
|
|
7578
|
+
|
|
7579
|
+
|
|
7580
|
+
|
|
7581
|
+
|
|
7582
|
+
|
|
7583
|
+
|
|
7584
|
+
|
|
7307
7585
|
|
|
7308
7586
|
|
|
7309
7587
|
|
|
@@ -7432,6 +7710,18 @@ var _AVLTree = class _AVLTree extends BST {
|
|
|
7432
7710
|
|
|
7433
7711
|
|
|
7434
7712
|
|
|
7713
|
+
|
|
7714
|
+
|
|
7715
|
+
|
|
7716
|
+
|
|
7717
|
+
|
|
7718
|
+
|
|
7719
|
+
|
|
7720
|
+
|
|
7721
|
+
|
|
7722
|
+
|
|
7723
|
+
|
|
7724
|
+
|
|
7435
7725
|
|
|
7436
7726
|
|
|
7437
7727
|
|
|
@@ -7453,13 +7743,13 @@ var _AVLTree = class _AVLTree extends BST {
|
|
|
7453
7743
|
* console.log(avl.size); // 6;
|
|
7454
7744
|
*/
|
|
7455
7745
|
delete(keyNodeOrEntry) {
|
|
7456
|
-
const deletedResults =
|
|
7746
|
+
const deletedResults = this._deleteInternal(keyNodeOrEntry);
|
|
7457
7747
|
for (const { needBalanced } of deletedResults) {
|
|
7458
7748
|
if (needBalanced) {
|
|
7459
7749
|
this._balancePath(needBalanced);
|
|
7460
7750
|
}
|
|
7461
7751
|
}
|
|
7462
|
-
return deletedResults;
|
|
7752
|
+
return deletedResults.length > 0;
|
|
7463
7753
|
}
|
|
7464
7754
|
/**
|
|
7465
7755
|
* Rebuilds the tree to be perfectly balanced.
|
|
@@ -7519,6 +7809,14 @@ var _AVLTree = class _AVLTree extends BST {
|
|
|
7519
7809
|
|
|
7520
7810
|
|
|
7521
7811
|
|
|
7812
|
+
|
|
7813
|
+
|
|
7814
|
+
|
|
7815
|
+
|
|
7816
|
+
|
|
7817
|
+
|
|
7818
|
+
|
|
7819
|
+
|
|
7522
7820
|
|
|
7523
7821
|
|
|
7524
7822
|
|
|
@@ -7651,6 +7949,18 @@ var _AVLTree = class _AVLTree extends BST {
|
|
|
7651
7949
|
|
|
7652
7950
|
|
|
7653
7951
|
|
|
7952
|
+
|
|
7953
|
+
|
|
7954
|
+
|
|
7955
|
+
|
|
7956
|
+
|
|
7957
|
+
|
|
7958
|
+
|
|
7959
|
+
|
|
7960
|
+
|
|
7961
|
+
|
|
7962
|
+
|
|
7963
|
+
|
|
7654
7964
|
|
|
7655
7965
|
|
|
7656
7966
|
|
|
@@ -8151,13 +8461,24 @@ var _RedBlackTree = class _RedBlackTree extends BST {
|
|
|
8151
8461
|
return keyNodeOrEntry instanceof RedBlackTreeNode;
|
|
8152
8462
|
}
|
|
8153
8463
|
/**
|
|
8154
|
-
|
|
8155
|
-
|
|
8156
|
-
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
|
|
8160
|
-
|
|
8464
|
+
* Remove all nodes, clear the key→value store (if in map mode) and internal caches.
|
|
8465
|
+
* @remarks Time O(n), Space O(1)
|
|
8466
|
+
|
|
8467
|
+
|
|
8468
|
+
|
|
8469
|
+
|
|
8470
|
+
|
|
8471
|
+
|
|
8472
|
+
|
|
8473
|
+
|
|
8474
|
+
|
|
8475
|
+
|
|
8476
|
+
|
|
8477
|
+
|
|
8478
|
+
|
|
8479
|
+
|
|
8480
|
+
|
|
8481
|
+
|
|
8161
8482
|
|
|
8162
8483
|
|
|
8163
8484
|
|
|
@@ -8750,6 +9071,22 @@ var _RedBlackTree = class _RedBlackTree extends BST {
|
|
|
8750
9071
|
|
|
8751
9072
|
|
|
8752
9073
|
|
|
9074
|
+
|
|
9075
|
+
|
|
9076
|
+
|
|
9077
|
+
|
|
9078
|
+
|
|
9079
|
+
|
|
9080
|
+
|
|
9081
|
+
|
|
9082
|
+
|
|
9083
|
+
|
|
9084
|
+
|
|
9085
|
+
|
|
9086
|
+
|
|
9087
|
+
|
|
9088
|
+
|
|
9089
|
+
|
|
8753
9090
|
|
|
8754
9091
|
|
|
8755
9092
|
|
|
@@ -8949,6 +9286,22 @@ var _RedBlackTree = class _RedBlackTree extends BST {
|
|
|
8949
9286
|
|
|
8950
9287
|
|
|
8951
9288
|
|
|
9289
|
+
|
|
9290
|
+
|
|
9291
|
+
|
|
9292
|
+
|
|
9293
|
+
|
|
9294
|
+
|
|
9295
|
+
|
|
9296
|
+
|
|
9297
|
+
|
|
9298
|
+
|
|
9299
|
+
|
|
9300
|
+
|
|
9301
|
+
|
|
9302
|
+
|
|
9303
|
+
|
|
9304
|
+
|
|
8952
9305
|
|
|
8953
9306
|
|
|
8954
9307
|
|
|
@@ -8975,13 +9328,12 @@ var _RedBlackTree = class _RedBlackTree extends BST {
|
|
|
8975
9328
|
*/
|
|
8976
9329
|
delete(keyNodeEntryRawOrPredicate) {
|
|
8977
9330
|
var _a, _b, _c;
|
|
8978
|
-
if (keyNodeEntryRawOrPredicate === null) return
|
|
8979
|
-
const results = [];
|
|
9331
|
+
if (keyNodeEntryRawOrPredicate === null) return false;
|
|
8980
9332
|
let nodeToDelete;
|
|
8981
9333
|
if (this._isPredicate(keyNodeEntryRawOrPredicate)) nodeToDelete = this.getNode(keyNodeEntryRawOrPredicate);
|
|
8982
9334
|
else nodeToDelete = this.isRealNode(keyNodeEntryRawOrPredicate) ? keyNodeEntryRawOrPredicate : this.getNode(keyNodeEntryRawOrPredicate);
|
|
8983
9335
|
if (!nodeToDelete) {
|
|
8984
|
-
return
|
|
9336
|
+
return false;
|
|
8985
9337
|
}
|
|
8986
9338
|
const willDeleteMin = nodeToDelete === this._minNode;
|
|
8987
9339
|
const willDeleteMax = nodeToDelete === this._maxNode;
|
|
@@ -9037,8 +9389,7 @@ var _RedBlackTree = class _RedBlackTree extends BST {
|
|
|
9037
9389
|
if (originalColor === "BLACK") {
|
|
9038
9390
|
this._deleteFixup(replacementNode);
|
|
9039
9391
|
}
|
|
9040
|
-
|
|
9041
|
-
return results;
|
|
9392
|
+
return true;
|
|
9042
9393
|
}
|
|
9043
9394
|
/**
|
|
9044
9395
|
* Transform entries into a like-kind red-black tree with possibly different key/value types.
|
|
@@ -9139,6 +9490,18 @@ var _RedBlackTree = class _RedBlackTree extends BST {
|
|
|
9139
9490
|
|
|
9140
9491
|
|
|
9141
9492
|
|
|
9493
|
+
|
|
9494
|
+
|
|
9495
|
+
|
|
9496
|
+
|
|
9497
|
+
|
|
9498
|
+
|
|
9499
|
+
|
|
9500
|
+
|
|
9501
|
+
|
|
9502
|
+
|
|
9503
|
+
|
|
9504
|
+
|
|
9142
9505
|
|
|
9143
9506
|
|
|
9144
9507
|
|
|
@@ -9287,6 +9650,22 @@ var _RedBlackTree = class _RedBlackTree extends BST {
|
|
|
9287
9650
|
|
|
9288
9651
|
|
|
9289
9652
|
|
|
9653
|
+
|
|
9654
|
+
|
|
9655
|
+
|
|
9656
|
+
|
|
9657
|
+
|
|
9658
|
+
|
|
9659
|
+
|
|
9660
|
+
|
|
9661
|
+
|
|
9662
|
+
|
|
9663
|
+
|
|
9664
|
+
|
|
9665
|
+
|
|
9666
|
+
|
|
9667
|
+
|
|
9668
|
+
|
|
9290
9669
|
|
|
9291
9670
|
|
|
9292
9671
|
|
|
@@ -9802,6 +10181,26 @@ var _TreeSet = class _TreeSet {
|
|
|
9802
10181
|
|
|
9803
10182
|
|
|
9804
10183
|
|
|
10184
|
+
|
|
10185
|
+
|
|
10186
|
+
|
|
10187
|
+
|
|
10188
|
+
|
|
10189
|
+
|
|
10190
|
+
|
|
10191
|
+
|
|
10192
|
+
|
|
10193
|
+
|
|
10194
|
+
|
|
10195
|
+
|
|
10196
|
+
|
|
10197
|
+
|
|
10198
|
+
|
|
10199
|
+
|
|
10200
|
+
|
|
10201
|
+
|
|
10202
|
+
|
|
10203
|
+
|
|
9805
10204
|
|
|
9806
10205
|
|
|
9807
10206
|
|
|
@@ -10007,28 +10406,103 @@ var _TreeSet = class _TreeSet {
|
|
|
10007
10406
|
|
|
10008
10407
|
|
|
10009
10408
|
|
|
10010
|
-
|
|
10011
|
-
|
|
10012
|
-
|
|
10013
|
-
|
|
10014
|
-
|
|
10015
|
-
|
|
10016
|
-
|
|
10017
|
-
|
|
10018
|
-
|
|
10019
|
-
|
|
10020
|
-
|
|
10021
|
-
|
|
10022
|
-
|
|
10023
|
-
|
|
10024
|
-
|
|
10025
|
-
|
|
10026
|
-
|
|
10027
|
-
|
|
10028
|
-
|
|
10029
|
-
|
|
10030
|
-
|
|
10031
|
-
|
|
10409
|
+
|
|
10410
|
+
|
|
10411
|
+
|
|
10412
|
+
|
|
10413
|
+
|
|
10414
|
+
|
|
10415
|
+
|
|
10416
|
+
|
|
10417
|
+
|
|
10418
|
+
|
|
10419
|
+
|
|
10420
|
+
|
|
10421
|
+
|
|
10422
|
+
|
|
10423
|
+
|
|
10424
|
+
|
|
10425
|
+
|
|
10426
|
+
|
|
10427
|
+
|
|
10428
|
+
|
|
10429
|
+
* @example
|
|
10430
|
+
* // Unique tags with sorted order
|
|
10431
|
+
* const tags = new TreeSet<string>(['javascript', 'typescript', 'react', 'typescript', 'node']);
|
|
10432
|
+
*
|
|
10433
|
+
* // Duplicates removed, sorted alphabetically
|
|
10434
|
+
* console.log([...tags]); // ['javascript', 'node', 'react', 'typescript'];
|
|
10435
|
+
* console.log(tags.size); // 4;
|
|
10436
|
+
*
|
|
10437
|
+
* tags.add('angular');
|
|
10438
|
+
* console.log(tags.first()); // 'angular';
|
|
10439
|
+
* console.log(tags.last()); // 'typescript';
|
|
10440
|
+
*/
|
|
10441
|
+
add(key) {
|
|
10442
|
+
this._validateKey(key);
|
|
10443
|
+
__privateGet(this, _core).set(key, void 0);
|
|
10444
|
+
return this;
|
|
10445
|
+
}
|
|
10446
|
+
/**
|
|
10447
|
+
* Add multiple keys at once.
|
|
10448
|
+
* @remarks Expected time O(m log n), where m is the number of keys.
|
|
10449
|
+
* @param keys - Iterable of keys to add.
|
|
10450
|
+
* @returns Array of booleans indicating whether each key was newly added.
|
|
10451
|
+
|
|
10452
|
+
|
|
10453
|
+
|
|
10454
|
+
|
|
10455
|
+
|
|
10456
|
+
|
|
10457
|
+
|
|
10458
|
+
|
|
10459
|
+
|
|
10460
|
+
|
|
10461
|
+
|
|
10462
|
+
|
|
10463
|
+
|
|
10464
|
+
|
|
10465
|
+
|
|
10466
|
+
|
|
10467
|
+
* @example
|
|
10468
|
+
* // Add multiple keys
|
|
10469
|
+
* const ts = new TreeSet<number>();
|
|
10470
|
+
* ts.addMany([5, 3, 7, 1, 9]);
|
|
10471
|
+
* console.log(ts.size); // 5;
|
|
10472
|
+
*/
|
|
10473
|
+
addMany(keys) {
|
|
10474
|
+
const results = [];
|
|
10475
|
+
for (const key of keys) {
|
|
10476
|
+
this._validateKey(key);
|
|
10477
|
+
results.push(__privateGet(this, _core).set(key, void 0));
|
|
10478
|
+
}
|
|
10479
|
+
return results;
|
|
10480
|
+
}
|
|
10481
|
+
/**
|
|
10482
|
+
* Test whether a key exists.
|
|
10483
|
+
* @remarks Expected time O(log n)
|
|
10484
|
+
|
|
10485
|
+
|
|
10486
|
+
|
|
10487
|
+
|
|
10488
|
+
|
|
10489
|
+
|
|
10490
|
+
|
|
10491
|
+
|
|
10492
|
+
|
|
10493
|
+
|
|
10494
|
+
|
|
10495
|
+
|
|
10496
|
+
|
|
10497
|
+
|
|
10498
|
+
|
|
10499
|
+
|
|
10500
|
+
|
|
10501
|
+
|
|
10502
|
+
|
|
10503
|
+
|
|
10504
|
+
|
|
10505
|
+
|
|
10032
10506
|
|
|
10033
10507
|
|
|
10034
10508
|
|
|
@@ -10359,6 +10833,26 @@ var _TreeSet = class _TreeSet {
|
|
|
10359
10833
|
|
|
10360
10834
|
|
|
10361
10835
|
|
|
10836
|
+
|
|
10837
|
+
|
|
10838
|
+
|
|
10839
|
+
|
|
10840
|
+
|
|
10841
|
+
|
|
10842
|
+
|
|
10843
|
+
|
|
10844
|
+
|
|
10845
|
+
|
|
10846
|
+
|
|
10847
|
+
|
|
10848
|
+
|
|
10849
|
+
|
|
10850
|
+
|
|
10851
|
+
|
|
10852
|
+
|
|
10853
|
+
|
|
10854
|
+
|
|
10855
|
+
|
|
10362
10856
|
|
|
10363
10857
|
|
|
10364
10858
|
|
|
@@ -10389,10 +10883,25 @@ var _TreeSet = class _TreeSet {
|
|
|
10389
10883
|
* console.log([...nums]); // [1, 3, 7, 9];
|
|
10390
10884
|
*/
|
|
10391
10885
|
delete(key) {
|
|
10392
|
-
var _a;
|
|
10393
10886
|
this._validateKey(key);
|
|
10394
|
-
|
|
10395
|
-
|
|
10887
|
+
return __privateGet(this, _core).delete(key);
|
|
10888
|
+
}
|
|
10889
|
+
/**
|
|
10890
|
+
* Delete all keys matching a predicate.
|
|
10891
|
+
* @remarks Time O(N), Space O(N)
|
|
10892
|
+
* @param predicate - Function (key, index, set) → boolean; return true to delete.
|
|
10893
|
+
* @returns True if at least one key was deleted.
|
|
10894
|
+
*/
|
|
10895
|
+
deleteWhere(predicate) {
|
|
10896
|
+
let deleted = false;
|
|
10897
|
+
let index = 0;
|
|
10898
|
+
for (const key of this) {
|
|
10899
|
+
if (predicate(key, index++, this)) {
|
|
10900
|
+
this.delete(key);
|
|
10901
|
+
deleted = true;
|
|
10902
|
+
}
|
|
10903
|
+
}
|
|
10904
|
+
return deleted;
|
|
10396
10905
|
}
|
|
10397
10906
|
/**
|
|
10398
10907
|
* Remove all keys.
|
|
@@ -10533,6 +11042,26 @@ var _TreeSet = class _TreeSet {
|
|
|
10533
11042
|
|
|
10534
11043
|
|
|
10535
11044
|
|
|
11045
|
+
|
|
11046
|
+
|
|
11047
|
+
|
|
11048
|
+
|
|
11049
|
+
|
|
11050
|
+
|
|
11051
|
+
|
|
11052
|
+
|
|
11053
|
+
|
|
11054
|
+
|
|
11055
|
+
|
|
11056
|
+
|
|
11057
|
+
|
|
11058
|
+
|
|
11059
|
+
|
|
11060
|
+
|
|
11061
|
+
|
|
11062
|
+
|
|
11063
|
+
|
|
11064
|
+
|
|
10536
11065
|
|
|
10537
11066
|
|
|
10538
11067
|
|
|
@@ -10702,6 +11231,26 @@ var _TreeSet = class _TreeSet {
|
|
|
10702
11231
|
|
|
10703
11232
|
|
|
10704
11233
|
|
|
11234
|
+
|
|
11235
|
+
|
|
11236
|
+
|
|
11237
|
+
|
|
11238
|
+
|
|
11239
|
+
|
|
11240
|
+
|
|
11241
|
+
|
|
11242
|
+
|
|
11243
|
+
|
|
11244
|
+
|
|
11245
|
+
|
|
11246
|
+
|
|
11247
|
+
|
|
11248
|
+
|
|
11249
|
+
|
|
11250
|
+
|
|
11251
|
+
|
|
11252
|
+
|
|
11253
|
+
|
|
10705
11254
|
|
|
10706
11255
|
|
|
10707
11256
|
|
|
@@ -10872,6 +11421,26 @@ var _TreeSet = class _TreeSet {
|
|
|
10872
11421
|
|
|
10873
11422
|
|
|
10874
11423
|
|
|
11424
|
+
|
|
11425
|
+
|
|
11426
|
+
|
|
11427
|
+
|
|
11428
|
+
|
|
11429
|
+
|
|
11430
|
+
|
|
11431
|
+
|
|
11432
|
+
|
|
11433
|
+
|
|
11434
|
+
|
|
11435
|
+
|
|
11436
|
+
|
|
11437
|
+
|
|
11438
|
+
|
|
11439
|
+
|
|
11440
|
+
|
|
11441
|
+
|
|
11442
|
+
|
|
11443
|
+
|
|
10875
11444
|
|
|
10876
11445
|
|
|
10877
11446
|
|
|
@@ -11042,6 +11611,26 @@ var _TreeSet = class _TreeSet {
|
|
|
11042
11611
|
|
|
11043
11612
|
|
|
11044
11613
|
|
|
11614
|
+
|
|
11615
|
+
|
|
11616
|
+
|
|
11617
|
+
|
|
11618
|
+
|
|
11619
|
+
|
|
11620
|
+
|
|
11621
|
+
|
|
11622
|
+
|
|
11623
|
+
|
|
11624
|
+
|
|
11625
|
+
|
|
11626
|
+
|
|
11627
|
+
|
|
11628
|
+
|
|
11629
|
+
|
|
11630
|
+
|
|
11631
|
+
|
|
11632
|
+
|
|
11633
|
+
|
|
11045
11634
|
|
|
11046
11635
|
|
|
11047
11636
|
|
|
@@ -11215,6 +11804,26 @@ var _TreeSet = class _TreeSet {
|
|
|
11215
11804
|
|
|
11216
11805
|
|
|
11217
11806
|
|
|
11807
|
+
|
|
11808
|
+
|
|
11809
|
+
|
|
11810
|
+
|
|
11811
|
+
|
|
11812
|
+
|
|
11813
|
+
|
|
11814
|
+
|
|
11815
|
+
|
|
11816
|
+
|
|
11817
|
+
|
|
11818
|
+
|
|
11819
|
+
|
|
11820
|
+
|
|
11821
|
+
|
|
11822
|
+
|
|
11823
|
+
|
|
11824
|
+
|
|
11825
|
+
|
|
11826
|
+
|
|
11218
11827
|
|
|
11219
11828
|
|
|
11220
11829
|
|
|
@@ -11388,6 +11997,26 @@ var _TreeSet = class _TreeSet {
|
|
|
11388
11997
|
|
|
11389
11998
|
|
|
11390
11999
|
|
|
12000
|
+
|
|
12001
|
+
|
|
12002
|
+
|
|
12003
|
+
|
|
12004
|
+
|
|
12005
|
+
|
|
12006
|
+
|
|
12007
|
+
|
|
12008
|
+
|
|
12009
|
+
|
|
12010
|
+
|
|
12011
|
+
|
|
12012
|
+
|
|
12013
|
+
|
|
12014
|
+
|
|
12015
|
+
|
|
12016
|
+
|
|
12017
|
+
|
|
12018
|
+
|
|
12019
|
+
|
|
11391
12020
|
|
|
11392
12021
|
|
|
11393
12022
|
|
|
@@ -11564,6 +12193,26 @@ var _TreeSet = class _TreeSet {
|
|
|
11564
12193
|
|
|
11565
12194
|
|
|
11566
12195
|
|
|
12196
|
+
|
|
12197
|
+
|
|
12198
|
+
|
|
12199
|
+
|
|
12200
|
+
|
|
12201
|
+
|
|
12202
|
+
|
|
12203
|
+
|
|
12204
|
+
|
|
12205
|
+
|
|
12206
|
+
|
|
12207
|
+
|
|
12208
|
+
|
|
12209
|
+
|
|
12210
|
+
|
|
12211
|
+
|
|
12212
|
+
|
|
12213
|
+
|
|
12214
|
+
|
|
12215
|
+
|
|
11567
12216
|
|
|
11568
12217
|
|
|
11569
12218
|
|
|
@@ -11740,6 +12389,26 @@ var _TreeSet = class _TreeSet {
|
|
|
11740
12389
|
|
|
11741
12390
|
|
|
11742
12391
|
|
|
12392
|
+
|
|
12393
|
+
|
|
12394
|
+
|
|
12395
|
+
|
|
12396
|
+
|
|
12397
|
+
|
|
12398
|
+
|
|
12399
|
+
|
|
12400
|
+
|
|
12401
|
+
|
|
12402
|
+
|
|
12403
|
+
|
|
12404
|
+
|
|
12405
|
+
|
|
12406
|
+
|
|
12407
|
+
|
|
12408
|
+
|
|
12409
|
+
|
|
12410
|
+
|
|
12411
|
+
|
|
11743
12412
|
|
|
11744
12413
|
|
|
11745
12414
|
|
|
@@ -11911,6 +12580,26 @@ var _TreeSet = class _TreeSet {
|
|
|
11911
12580
|
|
|
11912
12581
|
|
|
11913
12582
|
|
|
12583
|
+
|
|
12584
|
+
|
|
12585
|
+
|
|
12586
|
+
|
|
12587
|
+
|
|
12588
|
+
|
|
12589
|
+
|
|
12590
|
+
|
|
12591
|
+
|
|
12592
|
+
|
|
12593
|
+
|
|
12594
|
+
|
|
12595
|
+
|
|
12596
|
+
|
|
12597
|
+
|
|
12598
|
+
|
|
12599
|
+
|
|
12600
|
+
|
|
12601
|
+
|
|
12602
|
+
|
|
11914
12603
|
|
|
11915
12604
|
|
|
11916
12605
|
|
|
@@ -12083,6 +12772,26 @@ var _TreeSet = class _TreeSet {
|
|
|
12083
12772
|
|
|
12084
12773
|
|
|
12085
12774
|
|
|
12775
|
+
|
|
12776
|
+
|
|
12777
|
+
|
|
12778
|
+
|
|
12779
|
+
|
|
12780
|
+
|
|
12781
|
+
|
|
12782
|
+
|
|
12783
|
+
|
|
12784
|
+
|
|
12785
|
+
|
|
12786
|
+
|
|
12787
|
+
|
|
12788
|
+
|
|
12789
|
+
|
|
12790
|
+
|
|
12791
|
+
|
|
12792
|
+
|
|
12793
|
+
|
|
12794
|
+
|
|
12086
12795
|
|
|
12087
12796
|
|
|
12088
12797
|
|
|
@@ -12276,23 +12985,63 @@ var _TreeSet = class _TreeSet {
|
|
|
12276
12985
|
|
|
12277
12986
|
|
|
12278
12987
|
|
|
12279
|
-
|
|
12280
|
-
|
|
12281
|
-
|
|
12282
|
-
|
|
12283
|
-
|
|
12284
|
-
|
|
12285
|
-
|
|
12286
|
-
|
|
12287
|
-
|
|
12288
|
-
|
|
12289
|
-
|
|
12290
|
-
|
|
12291
|
-
|
|
12292
|
-
|
|
12293
|
-
|
|
12294
|
-
|
|
12295
|
-
|
|
12988
|
+
|
|
12989
|
+
|
|
12990
|
+
|
|
12991
|
+
|
|
12992
|
+
|
|
12993
|
+
|
|
12994
|
+
|
|
12995
|
+
|
|
12996
|
+
|
|
12997
|
+
|
|
12998
|
+
|
|
12999
|
+
|
|
13000
|
+
|
|
13001
|
+
|
|
13002
|
+
|
|
13003
|
+
|
|
13004
|
+
|
|
13005
|
+
|
|
13006
|
+
|
|
13007
|
+
|
|
13008
|
+
* @example
|
|
13009
|
+
* // Find entry
|
|
13010
|
+
* const ts = new TreeSet<number>([1, 2, 3]);
|
|
13011
|
+
* const found = ts.find(k => k === 2);
|
|
13012
|
+
* console.log(found); // 2;
|
|
13013
|
+
*/
|
|
13014
|
+
find(callbackfn, thisArg) {
|
|
13015
|
+
let index = 0;
|
|
13016
|
+
for (const v of this) {
|
|
13017
|
+
const ok = thisArg === void 0 ? callbackfn(v, index++, this) : callbackfn.call(thisArg, v, index++, this);
|
|
13018
|
+
if (ok) return v;
|
|
13019
|
+
}
|
|
13020
|
+
return void 0;
|
|
13021
|
+
}
|
|
13022
|
+
/**
|
|
13023
|
+
* Materialize the set into an array of keys.
|
|
13024
|
+
* @remarks Time O(n), Space O(n)
|
|
13025
|
+
|
|
13026
|
+
|
|
13027
|
+
|
|
13028
|
+
|
|
13029
|
+
|
|
13030
|
+
|
|
13031
|
+
|
|
13032
|
+
|
|
13033
|
+
|
|
13034
|
+
|
|
13035
|
+
|
|
13036
|
+
|
|
13037
|
+
|
|
13038
|
+
|
|
13039
|
+
|
|
13040
|
+
|
|
13041
|
+
|
|
13042
|
+
|
|
13043
|
+
|
|
13044
|
+
|
|
12296
13045
|
|
|
12297
13046
|
|
|
12298
13047
|
|
|
@@ -12599,6 +13348,26 @@ var _TreeSet = class _TreeSet {
|
|
|
12599
13348
|
|
|
12600
13349
|
|
|
12601
13350
|
|
|
13351
|
+
|
|
13352
|
+
|
|
13353
|
+
|
|
13354
|
+
|
|
13355
|
+
|
|
13356
|
+
|
|
13357
|
+
|
|
13358
|
+
|
|
13359
|
+
|
|
13360
|
+
|
|
13361
|
+
|
|
13362
|
+
|
|
13363
|
+
|
|
13364
|
+
|
|
13365
|
+
|
|
13366
|
+
|
|
13367
|
+
|
|
13368
|
+
|
|
13369
|
+
|
|
13370
|
+
|
|
12602
13371
|
|
|
12603
13372
|
|
|
12604
13373
|
|
|
@@ -12661,6 +13430,10 @@ var _TreeSet = class _TreeSet {
|
|
|
12661
13430
|
|
|
12662
13431
|
|
|
12663
13432
|
|
|
13433
|
+
|
|
13434
|
+
|
|
13435
|
+
|
|
13436
|
+
|
|
12664
13437
|
|
|
12665
13438
|
|
|
12666
13439
|
|
|
@@ -12729,6 +13502,10 @@ var _TreeSet = class _TreeSet {
|
|
|
12729
13502
|
|
|
12730
13503
|
|
|
12731
13504
|
|
|
13505
|
+
|
|
13506
|
+
|
|
13507
|
+
|
|
13508
|
+
|
|
12732
13509
|
|
|
12733
13510
|
|
|
12734
13511
|
|
|
@@ -12775,6 +13552,10 @@ var _TreeSet = class _TreeSet {
|
|
|
12775
13552
|
|
|
12776
13553
|
|
|
12777
13554
|
|
|
13555
|
+
|
|
13556
|
+
|
|
13557
|
+
|
|
13558
|
+
|
|
12778
13559
|
|
|
12779
13560
|
|
|
12780
13561
|
|
|
@@ -12826,6 +13607,10 @@ var _TreeSet = class _TreeSet {
|
|
|
12826
13607
|
|
|
12827
13608
|
|
|
12828
13609
|
|
|
13610
|
+
|
|
13611
|
+
|
|
13612
|
+
|
|
13613
|
+
|
|
12829
13614
|
|
|
12830
13615
|
|
|
12831
13616
|
|
|
@@ -12963,6 +13748,22 @@ var _TreeSet = class _TreeSet {
|
|
|
12963
13748
|
|
|
12964
13749
|
|
|
12965
13750
|
|
|
13751
|
+
|
|
13752
|
+
|
|
13753
|
+
|
|
13754
|
+
|
|
13755
|
+
|
|
13756
|
+
|
|
13757
|
+
|
|
13758
|
+
|
|
13759
|
+
|
|
13760
|
+
|
|
13761
|
+
|
|
13762
|
+
|
|
13763
|
+
|
|
13764
|
+
|
|
13765
|
+
|
|
13766
|
+
|
|
12966
13767
|
|
|
12967
13768
|
|
|
12968
13769
|
|
|
@@ -13120,6 +13921,22 @@ var _TreeSet = class _TreeSet {
|
|
|
13120
13921
|
|
|
13121
13922
|
|
|
13122
13923
|
|
|
13924
|
+
|
|
13925
|
+
|
|
13926
|
+
|
|
13927
|
+
|
|
13928
|
+
|
|
13929
|
+
|
|
13930
|
+
|
|
13931
|
+
|
|
13932
|
+
|
|
13933
|
+
|
|
13934
|
+
|
|
13935
|
+
|
|
13936
|
+
|
|
13937
|
+
|
|
13938
|
+
|
|
13939
|
+
|
|
13123
13940
|
|
|
13124
13941
|
|
|
13125
13942
|
|
|
@@ -13269,6 +14086,22 @@ var _TreeSet = class _TreeSet {
|
|
|
13269
14086
|
|
|
13270
14087
|
|
|
13271
14088
|
|
|
14089
|
+
|
|
14090
|
+
|
|
14091
|
+
|
|
14092
|
+
|
|
14093
|
+
|
|
14094
|
+
|
|
14095
|
+
|
|
14096
|
+
|
|
14097
|
+
|
|
14098
|
+
|
|
14099
|
+
|
|
14100
|
+
|
|
14101
|
+
|
|
14102
|
+
|
|
14103
|
+
|
|
14104
|
+
|
|
13272
14105
|
|
|
13273
14106
|
|
|
13274
14107
|
|
|
@@ -13416,6 +14249,22 @@ var _TreeSet = class _TreeSet {
|
|
|
13416
14249
|
|
|
13417
14250
|
|
|
13418
14251
|
|
|
14252
|
+
|
|
14253
|
+
|
|
14254
|
+
|
|
14255
|
+
|
|
14256
|
+
|
|
14257
|
+
|
|
14258
|
+
|
|
14259
|
+
|
|
14260
|
+
|
|
14261
|
+
|
|
14262
|
+
|
|
14263
|
+
|
|
14264
|
+
|
|
14265
|
+
|
|
14266
|
+
|
|
14267
|
+
|
|
13419
14268
|
|
|
13420
14269
|
|
|
13421
14270
|
|
|
@@ -13566,6 +14415,22 @@ var _TreeSet = class _TreeSet {
|
|
|
13566
14415
|
|
|
13567
14416
|
|
|
13568
14417
|
|
|
14418
|
+
|
|
14419
|
+
|
|
14420
|
+
|
|
14421
|
+
|
|
14422
|
+
|
|
14423
|
+
|
|
14424
|
+
|
|
14425
|
+
|
|
14426
|
+
|
|
14427
|
+
|
|
14428
|
+
|
|
14429
|
+
|
|
14430
|
+
|
|
14431
|
+
|
|
14432
|
+
|
|
14433
|
+
|
|
13569
14434
|
|
|
13570
14435
|
|
|
13571
14436
|
|
|
@@ -13655,8 +14520,16 @@ var _TreeSet = class _TreeSet {
|
|
|
13655
14520
|
* Returns elements by rank range (0-indexed, inclusive on both ends).
|
|
13656
14521
|
* @remarks Time O(log n + k). Requires `enableOrderStatistic: true`.
|
|
13657
14522
|
|
|
14523
|
+
|
|
14524
|
+
|
|
14525
|
+
|
|
14526
|
+
|
|
14527
|
+
|
|
14528
|
+
|
|
14529
|
+
|
|
14530
|
+
|
|
13658
14531
|
* @example
|
|
13659
|
-
* // Pagination
|
|
14532
|
+
* // Pagination by position in tree order
|
|
13660
14533
|
* const tree = new TreeSet<number>(
|
|
13661
14534
|
* [10, 20, 30, 40, 50, 60, 70, 80, 90],
|
|
13662
14535
|
* { enableOrderStatistic: true }
|
|
@@ -13814,6 +14687,26 @@ var _TreeSet = class _TreeSet {
|
|
|
13814
14687
|
|
|
13815
14688
|
|
|
13816
14689
|
|
|
14690
|
+
|
|
14691
|
+
|
|
14692
|
+
|
|
14693
|
+
|
|
14694
|
+
|
|
14695
|
+
|
|
14696
|
+
|
|
14697
|
+
|
|
14698
|
+
|
|
14699
|
+
|
|
14700
|
+
|
|
14701
|
+
|
|
14702
|
+
|
|
14703
|
+
|
|
14704
|
+
|
|
14705
|
+
|
|
14706
|
+
|
|
14707
|
+
|
|
14708
|
+
|
|
14709
|
+
|
|
13817
14710
|
|
|
13818
14711
|
|
|
13819
14712
|
|
|
@@ -14068,6 +14961,26 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
14068
14961
|
|
|
14069
14962
|
|
|
14070
14963
|
|
|
14964
|
+
|
|
14965
|
+
|
|
14966
|
+
|
|
14967
|
+
|
|
14968
|
+
|
|
14969
|
+
|
|
14970
|
+
|
|
14971
|
+
|
|
14972
|
+
|
|
14973
|
+
|
|
14974
|
+
|
|
14975
|
+
|
|
14976
|
+
|
|
14977
|
+
|
|
14978
|
+
|
|
14979
|
+
|
|
14980
|
+
|
|
14981
|
+
|
|
14982
|
+
|
|
14983
|
+
|
|
14071
14984
|
|
|
14072
14985
|
|
|
14073
14986
|
|
|
@@ -14236,6 +15149,26 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
14236
15149
|
|
|
14237
15150
|
|
|
14238
15151
|
|
|
15152
|
+
|
|
15153
|
+
|
|
15154
|
+
|
|
15155
|
+
|
|
15156
|
+
|
|
15157
|
+
|
|
15158
|
+
|
|
15159
|
+
|
|
15160
|
+
|
|
15161
|
+
|
|
15162
|
+
|
|
15163
|
+
|
|
15164
|
+
|
|
15165
|
+
|
|
15166
|
+
|
|
15167
|
+
|
|
15168
|
+
|
|
15169
|
+
|
|
15170
|
+
|
|
15171
|
+
|
|
14239
15172
|
|
|
14240
15173
|
|
|
14241
15174
|
|
|
@@ -14291,6 +15224,10 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
14291
15224
|
|
|
14292
15225
|
|
|
14293
15226
|
|
|
15227
|
+
|
|
15228
|
+
|
|
15229
|
+
|
|
15230
|
+
|
|
14294
15231
|
|
|
14295
15232
|
|
|
14296
15233
|
|
|
@@ -14331,6 +15268,10 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
14331
15268
|
|
|
14332
15269
|
|
|
14333
15270
|
|
|
15271
|
+
|
|
15272
|
+
|
|
15273
|
+
|
|
15274
|
+
|
|
14334
15275
|
|
|
14335
15276
|
|
|
14336
15277
|
|
|
@@ -14527,6 +15468,30 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
14527
15468
|
|
|
14528
15469
|
|
|
14529
15470
|
|
|
15471
|
+
|
|
15472
|
+
|
|
15473
|
+
|
|
15474
|
+
|
|
15475
|
+
|
|
15476
|
+
|
|
15477
|
+
|
|
15478
|
+
|
|
15479
|
+
|
|
15480
|
+
|
|
15481
|
+
|
|
15482
|
+
|
|
15483
|
+
|
|
15484
|
+
|
|
15485
|
+
|
|
15486
|
+
|
|
15487
|
+
|
|
15488
|
+
|
|
15489
|
+
|
|
15490
|
+
|
|
15491
|
+
|
|
15492
|
+
|
|
15493
|
+
|
|
15494
|
+
|
|
14530
15495
|
|
|
14531
15496
|
|
|
14532
15497
|
|
|
@@ -14737,6 +15702,30 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
14737
15702
|
|
|
14738
15703
|
|
|
14739
15704
|
|
|
15705
|
+
|
|
15706
|
+
|
|
15707
|
+
|
|
15708
|
+
|
|
15709
|
+
|
|
15710
|
+
|
|
15711
|
+
|
|
15712
|
+
|
|
15713
|
+
|
|
15714
|
+
|
|
15715
|
+
|
|
15716
|
+
|
|
15717
|
+
|
|
15718
|
+
|
|
15719
|
+
|
|
15720
|
+
|
|
15721
|
+
|
|
15722
|
+
|
|
15723
|
+
|
|
15724
|
+
|
|
15725
|
+
|
|
15726
|
+
|
|
15727
|
+
|
|
15728
|
+
|
|
14740
15729
|
|
|
14741
15730
|
|
|
14742
15731
|
|
|
@@ -14903,6 +15892,26 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
14903
15892
|
|
|
14904
15893
|
|
|
14905
15894
|
|
|
15895
|
+
|
|
15896
|
+
|
|
15897
|
+
|
|
15898
|
+
|
|
15899
|
+
|
|
15900
|
+
|
|
15901
|
+
|
|
15902
|
+
|
|
15903
|
+
|
|
15904
|
+
|
|
15905
|
+
|
|
15906
|
+
|
|
15907
|
+
|
|
15908
|
+
|
|
15909
|
+
|
|
15910
|
+
|
|
15911
|
+
|
|
15912
|
+
|
|
15913
|
+
|
|
15914
|
+
|
|
14906
15915
|
|
|
14907
15916
|
|
|
14908
15917
|
|
|
@@ -15138,6 +16147,30 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
15138
16147
|
|
|
15139
16148
|
|
|
15140
16149
|
|
|
16150
|
+
|
|
16151
|
+
|
|
16152
|
+
|
|
16153
|
+
|
|
16154
|
+
|
|
16155
|
+
|
|
16156
|
+
|
|
16157
|
+
|
|
16158
|
+
|
|
16159
|
+
|
|
16160
|
+
|
|
16161
|
+
|
|
16162
|
+
|
|
16163
|
+
|
|
16164
|
+
|
|
16165
|
+
|
|
16166
|
+
|
|
16167
|
+
|
|
16168
|
+
|
|
16169
|
+
|
|
16170
|
+
|
|
16171
|
+
|
|
16172
|
+
|
|
16173
|
+
|
|
15141
16174
|
|
|
15142
16175
|
|
|
15143
16176
|
|
|
@@ -15169,7 +16202,7 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
15169
16202
|
*/
|
|
15170
16203
|
delete(key) {
|
|
15171
16204
|
this._validateKey(key);
|
|
15172
|
-
return __privateGet(this, _core2).delete(key)
|
|
16205
|
+
return __privateGet(this, _core2).delete(key);
|
|
15173
16206
|
}
|
|
15174
16207
|
/**
|
|
15175
16208
|
* Check if a specific value exists in a key's bucket.
|
|
@@ -15195,6 +16228,10 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
15195
16228
|
|
|
15196
16229
|
|
|
15197
16230
|
|
|
16231
|
+
|
|
16232
|
+
|
|
16233
|
+
|
|
16234
|
+
|
|
15198
16235
|
|
|
15199
16236
|
|
|
15200
16237
|
|
|
@@ -15236,6 +16273,10 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
15236
16273
|
|
|
15237
16274
|
|
|
15238
16275
|
|
|
16276
|
+
|
|
16277
|
+
|
|
16278
|
+
|
|
16279
|
+
|
|
15239
16280
|
|
|
15240
16281
|
|
|
15241
16282
|
|
|
@@ -15282,6 +16323,10 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
15282
16323
|
|
|
15283
16324
|
|
|
15284
16325
|
|
|
16326
|
+
|
|
16327
|
+
|
|
16328
|
+
|
|
16329
|
+
|
|
15285
16330
|
|
|
15286
16331
|
|
|
15287
16332
|
|
|
@@ -15462,6 +16507,26 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
15462
16507
|
|
|
15463
16508
|
|
|
15464
16509
|
|
|
16510
|
+
|
|
16511
|
+
|
|
16512
|
+
|
|
16513
|
+
|
|
16514
|
+
|
|
16515
|
+
|
|
16516
|
+
|
|
16517
|
+
|
|
16518
|
+
|
|
16519
|
+
|
|
16520
|
+
|
|
16521
|
+
|
|
16522
|
+
|
|
16523
|
+
|
|
16524
|
+
|
|
16525
|
+
|
|
16526
|
+
|
|
16527
|
+
|
|
16528
|
+
|
|
16529
|
+
|
|
15465
16530
|
|
|
15466
16531
|
|
|
15467
16532
|
|
|
@@ -15633,6 +16698,26 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
15633
16698
|
|
|
15634
16699
|
|
|
15635
16700
|
|
|
16701
|
+
|
|
16702
|
+
|
|
16703
|
+
|
|
16704
|
+
|
|
16705
|
+
|
|
16706
|
+
|
|
16707
|
+
|
|
16708
|
+
|
|
16709
|
+
|
|
16710
|
+
|
|
16711
|
+
|
|
16712
|
+
|
|
16713
|
+
|
|
16714
|
+
|
|
16715
|
+
|
|
16716
|
+
|
|
16717
|
+
|
|
16718
|
+
|
|
16719
|
+
|
|
16720
|
+
|
|
15636
16721
|
|
|
15637
16722
|
|
|
15638
16723
|
|
|
@@ -15689,6 +16774,10 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
15689
16774
|
|
|
15690
16775
|
|
|
15691
16776
|
|
|
16777
|
+
|
|
16778
|
+
|
|
16779
|
+
|
|
16780
|
+
|
|
15692
16781
|
|
|
15693
16782
|
|
|
15694
16783
|
|
|
@@ -15730,6 +16819,10 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
15730
16819
|
|
|
15731
16820
|
|
|
15732
16821
|
|
|
16822
|
+
|
|
16823
|
+
|
|
16824
|
+
|
|
16825
|
+
|
|
15733
16826
|
|
|
15734
16827
|
|
|
15735
16828
|
|
|
@@ -15771,6 +16864,10 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
15771
16864
|
|
|
15772
16865
|
|
|
15773
16866
|
|
|
16867
|
+
|
|
16868
|
+
|
|
16869
|
+
|
|
16870
|
+
|
|
15774
16871
|
|
|
15775
16872
|
|
|
15776
16873
|
|
|
@@ -15846,6 +16943,14 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
15846
16943
|
|
|
15847
16944
|
|
|
15848
16945
|
|
|
16946
|
+
|
|
16947
|
+
|
|
16948
|
+
|
|
16949
|
+
|
|
16950
|
+
|
|
16951
|
+
|
|
16952
|
+
|
|
16953
|
+
|
|
15849
16954
|
|
|
15850
16955
|
|
|
15851
16956
|
|
|
@@ -15927,6 +17032,14 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
15927
17032
|
|
|
15928
17033
|
|
|
15929
17034
|
|
|
17035
|
+
|
|
17036
|
+
|
|
17037
|
+
|
|
17038
|
+
|
|
17039
|
+
|
|
17040
|
+
|
|
17041
|
+
|
|
17042
|
+
|
|
15930
17043
|
|
|
15931
17044
|
|
|
15932
17045
|
|
|
@@ -15977,6 +17090,10 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
15977
17090
|
|
|
15978
17091
|
|
|
15979
17092
|
|
|
17093
|
+
|
|
17094
|
+
|
|
17095
|
+
|
|
17096
|
+
|
|
15980
17097
|
|
|
15981
17098
|
|
|
15982
17099
|
|
|
@@ -16022,6 +17139,10 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
16022
17139
|
|
|
16023
17140
|
|
|
16024
17141
|
|
|
17142
|
+
|
|
17143
|
+
|
|
17144
|
+
|
|
17145
|
+
|
|
16025
17146
|
|
|
16026
17147
|
|
|
16027
17148
|
|
|
@@ -16184,6 +17305,26 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
16184
17305
|
|
|
16185
17306
|
|
|
16186
17307
|
|
|
17308
|
+
|
|
17309
|
+
|
|
17310
|
+
|
|
17311
|
+
|
|
17312
|
+
|
|
17313
|
+
|
|
17314
|
+
|
|
17315
|
+
|
|
17316
|
+
|
|
17317
|
+
|
|
17318
|
+
|
|
17319
|
+
|
|
17320
|
+
|
|
17321
|
+
|
|
17322
|
+
|
|
17323
|
+
|
|
17324
|
+
|
|
17325
|
+
|
|
17326
|
+
|
|
17327
|
+
|
|
16187
17328
|
|
|
16188
17329
|
|
|
16189
17330
|
|
|
@@ -16366,6 +17507,26 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
16366
17507
|
|
|
16367
17508
|
|
|
16368
17509
|
|
|
17510
|
+
|
|
17511
|
+
|
|
17512
|
+
|
|
17513
|
+
|
|
17514
|
+
|
|
17515
|
+
|
|
17516
|
+
|
|
17517
|
+
|
|
17518
|
+
|
|
17519
|
+
|
|
17520
|
+
|
|
17521
|
+
|
|
17522
|
+
|
|
17523
|
+
|
|
17524
|
+
|
|
17525
|
+
|
|
17526
|
+
|
|
17527
|
+
|
|
17528
|
+
|
|
17529
|
+
|
|
16369
17530
|
|
|
16370
17531
|
|
|
16371
17532
|
|
|
@@ -16517,6 +17678,22 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
16517
17678
|
|
|
16518
17679
|
|
|
16519
17680
|
|
|
17681
|
+
|
|
17682
|
+
|
|
17683
|
+
|
|
17684
|
+
|
|
17685
|
+
|
|
17686
|
+
|
|
17687
|
+
|
|
17688
|
+
|
|
17689
|
+
|
|
17690
|
+
|
|
17691
|
+
|
|
17692
|
+
|
|
17693
|
+
|
|
17694
|
+
|
|
17695
|
+
|
|
17696
|
+
|
|
16520
17697
|
|
|
16521
17698
|
|
|
16522
17699
|
|
|
@@ -16663,6 +17840,22 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
16663
17840
|
|
|
16664
17841
|
|
|
16665
17842
|
|
|
17843
|
+
|
|
17844
|
+
|
|
17845
|
+
|
|
17846
|
+
|
|
17847
|
+
|
|
17848
|
+
|
|
17849
|
+
|
|
17850
|
+
|
|
17851
|
+
|
|
17852
|
+
|
|
17853
|
+
|
|
17854
|
+
|
|
17855
|
+
|
|
17856
|
+
|
|
17857
|
+
|
|
17858
|
+
|
|
16666
17859
|
|
|
16667
17860
|
|
|
16668
17861
|
|
|
@@ -16838,6 +18031,26 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
16838
18031
|
|
|
16839
18032
|
|
|
16840
18033
|
|
|
18034
|
+
|
|
18035
|
+
|
|
18036
|
+
|
|
18037
|
+
|
|
18038
|
+
|
|
18039
|
+
|
|
18040
|
+
|
|
18041
|
+
|
|
18042
|
+
|
|
18043
|
+
|
|
18044
|
+
|
|
18045
|
+
|
|
18046
|
+
|
|
18047
|
+
|
|
18048
|
+
|
|
18049
|
+
|
|
18050
|
+
|
|
18051
|
+
|
|
18052
|
+
|
|
18053
|
+
|
|
16841
18054
|
|
|
16842
18055
|
|
|
16843
18056
|
|
|
@@ -17008,6 +18221,26 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
17008
18221
|
|
|
17009
18222
|
|
|
17010
18223
|
|
|
18224
|
+
|
|
18225
|
+
|
|
18226
|
+
|
|
18227
|
+
|
|
18228
|
+
|
|
18229
|
+
|
|
18230
|
+
|
|
18231
|
+
|
|
18232
|
+
|
|
18233
|
+
|
|
18234
|
+
|
|
18235
|
+
|
|
18236
|
+
|
|
18237
|
+
|
|
18238
|
+
|
|
18239
|
+
|
|
18240
|
+
|
|
18241
|
+
|
|
18242
|
+
|
|
18243
|
+
|
|
17011
18244
|
|
|
17012
18245
|
|
|
17013
18246
|
|
|
@@ -17183,6 +18416,26 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
17183
18416
|
|
|
17184
18417
|
|
|
17185
18418
|
|
|
18419
|
+
|
|
18420
|
+
|
|
18421
|
+
|
|
18422
|
+
|
|
18423
|
+
|
|
18424
|
+
|
|
18425
|
+
|
|
18426
|
+
|
|
18427
|
+
|
|
18428
|
+
|
|
18429
|
+
|
|
18430
|
+
|
|
18431
|
+
|
|
18432
|
+
|
|
18433
|
+
|
|
18434
|
+
|
|
18435
|
+
|
|
18436
|
+
|
|
18437
|
+
|
|
18438
|
+
|
|
17186
18439
|
|
|
17187
18440
|
|
|
17188
18441
|
|
|
@@ -17360,6 +18613,26 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
17360
18613
|
|
|
17361
18614
|
|
|
17362
18615
|
|
|
18616
|
+
|
|
18617
|
+
|
|
18618
|
+
|
|
18619
|
+
|
|
18620
|
+
|
|
18621
|
+
|
|
18622
|
+
|
|
18623
|
+
|
|
18624
|
+
|
|
18625
|
+
|
|
18626
|
+
|
|
18627
|
+
|
|
18628
|
+
|
|
18629
|
+
|
|
18630
|
+
|
|
18631
|
+
|
|
18632
|
+
|
|
18633
|
+
|
|
18634
|
+
|
|
18635
|
+
|
|
17363
18636
|
|
|
17364
18637
|
|
|
17365
18638
|
|
|
@@ -17535,6 +18808,26 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
17535
18808
|
|
|
17536
18809
|
|
|
17537
18810
|
|
|
18811
|
+
|
|
18812
|
+
|
|
18813
|
+
|
|
18814
|
+
|
|
18815
|
+
|
|
18816
|
+
|
|
18817
|
+
|
|
18818
|
+
|
|
18819
|
+
|
|
18820
|
+
|
|
18821
|
+
|
|
18822
|
+
|
|
18823
|
+
|
|
18824
|
+
|
|
18825
|
+
|
|
18826
|
+
|
|
18827
|
+
|
|
18828
|
+
|
|
18829
|
+
|
|
18830
|
+
|
|
17538
18831
|
|
|
17539
18832
|
|
|
17540
18833
|
|
|
@@ -17703,6 +18996,26 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
17703
18996
|
|
|
17704
18997
|
|
|
17705
18998
|
|
|
18999
|
+
|
|
19000
|
+
|
|
19001
|
+
|
|
19002
|
+
|
|
19003
|
+
|
|
19004
|
+
|
|
19005
|
+
|
|
19006
|
+
|
|
19007
|
+
|
|
19008
|
+
|
|
19009
|
+
|
|
19010
|
+
|
|
19011
|
+
|
|
19012
|
+
|
|
19013
|
+
|
|
19014
|
+
|
|
19015
|
+
|
|
19016
|
+
|
|
19017
|
+
|
|
19018
|
+
|
|
17706
19019
|
|
|
17707
19020
|
|
|
17708
19021
|
|
|
@@ -17849,6 +19162,22 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
17849
19162
|
|
|
17850
19163
|
|
|
17851
19164
|
|
|
19165
|
+
|
|
19166
|
+
|
|
19167
|
+
|
|
19168
|
+
|
|
19169
|
+
|
|
19170
|
+
|
|
19171
|
+
|
|
19172
|
+
|
|
19173
|
+
|
|
19174
|
+
|
|
19175
|
+
|
|
19176
|
+
|
|
19177
|
+
|
|
19178
|
+
|
|
19179
|
+
|
|
19180
|
+
|
|
17852
19181
|
|
|
17853
19182
|
|
|
17854
19183
|
|
|
@@ -18070,8 +19399,16 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
18070
19399
|
/**
|
|
18071
19400
|
* Get elements by rank range
|
|
18072
19401
|
|
|
19402
|
+
|
|
19403
|
+
|
|
19404
|
+
|
|
19405
|
+
|
|
19406
|
+
|
|
19407
|
+
|
|
19408
|
+
|
|
19409
|
+
|
|
18073
19410
|
* @example
|
|
18074
|
-
* // Pagination
|
|
19411
|
+
* // Pagination by position in tree order
|
|
18075
19412
|
* const tree = new TreeMultiMap<number>(
|
|
18076
19413
|
* [10, 20, 30, 40, 50, 60, 70, 80, 90],
|
|
18077
19414
|
* { enableOrderStatistic: true }
|
|
@@ -18097,6 +19434,26 @@ var _TreeMultiMap = class _TreeMultiMap {
|
|
|
18097
19434
|
|
|
18098
19435
|
|
|
18099
19436
|
|
|
19437
|
+
|
|
19438
|
+
|
|
19439
|
+
|
|
19440
|
+
|
|
19441
|
+
|
|
19442
|
+
|
|
19443
|
+
|
|
19444
|
+
|
|
19445
|
+
|
|
19446
|
+
|
|
19447
|
+
|
|
19448
|
+
|
|
19449
|
+
|
|
19450
|
+
|
|
19451
|
+
|
|
19452
|
+
|
|
19453
|
+
|
|
19454
|
+
|
|
19455
|
+
|
|
19456
|
+
|
|
18100
19457
|
|
|
18101
19458
|
* @example
|
|
18102
19459
|
* // Deep clone
|
|
@@ -18353,6 +19710,26 @@ var _TreeMap = class _TreeMap {
|
|
|
18353
19710
|
|
|
18354
19711
|
|
|
18355
19712
|
|
|
19713
|
+
|
|
19714
|
+
|
|
19715
|
+
|
|
19716
|
+
|
|
19717
|
+
|
|
19718
|
+
|
|
19719
|
+
|
|
19720
|
+
|
|
19721
|
+
|
|
19722
|
+
|
|
19723
|
+
|
|
19724
|
+
|
|
19725
|
+
|
|
19726
|
+
|
|
19727
|
+
|
|
19728
|
+
|
|
19729
|
+
|
|
19730
|
+
|
|
19731
|
+
|
|
19732
|
+
|
|
18356
19733
|
|
|
18357
19734
|
|
|
18358
19735
|
|
|
@@ -18530,6 +19907,26 @@ var _TreeMap = class _TreeMap {
|
|
|
18530
19907
|
|
|
18531
19908
|
|
|
18532
19909
|
|
|
19910
|
+
|
|
19911
|
+
|
|
19912
|
+
|
|
19913
|
+
|
|
19914
|
+
|
|
19915
|
+
|
|
19916
|
+
|
|
19917
|
+
|
|
19918
|
+
|
|
19919
|
+
|
|
19920
|
+
|
|
19921
|
+
|
|
19922
|
+
|
|
19923
|
+
|
|
19924
|
+
|
|
19925
|
+
|
|
19926
|
+
|
|
19927
|
+
|
|
19928
|
+
|
|
19929
|
+
|
|
18533
19930
|
|
|
18534
19931
|
|
|
18535
19932
|
|
|
@@ -18577,6 +19974,41 @@ var _TreeMap = class _TreeMap {
|
|
|
18577
19974
|
__privateGet(this, _core3).set(key, value);
|
|
18578
19975
|
return this;
|
|
18579
19976
|
}
|
|
19977
|
+
/**
|
|
19978
|
+
* Set multiple key-value pairs at once.
|
|
19979
|
+
* @remarks Expected time O(m log n), where m is the number of entries.
|
|
19980
|
+
* @param entries - Iterable of `[key, value]` tuples.
|
|
19981
|
+
* @returns Array of booleans indicating whether each entry was successfully set.
|
|
19982
|
+
|
|
19983
|
+
|
|
19984
|
+
|
|
19985
|
+
|
|
19986
|
+
|
|
19987
|
+
|
|
19988
|
+
|
|
19989
|
+
|
|
19990
|
+
|
|
19991
|
+
|
|
19992
|
+
|
|
19993
|
+
|
|
19994
|
+
|
|
19995
|
+
|
|
19996
|
+
|
|
19997
|
+
|
|
19998
|
+
* @example
|
|
19999
|
+
* // Set multiple key-value pairs
|
|
20000
|
+
* const tm = new TreeMap<number, string>();
|
|
20001
|
+
* tm.setMany([[1, 'a'], [2, 'b'], [3, 'c']]);
|
|
20002
|
+
* console.log(tm.size); // 3;
|
|
20003
|
+
*/
|
|
20004
|
+
setMany(entries) {
|
|
20005
|
+
const results = [];
|
|
20006
|
+
for (const [key, value] of entries) {
|
|
20007
|
+
this._validateKey(key);
|
|
20008
|
+
results.push(__privateGet(this, _core3).set(key, value));
|
|
20009
|
+
}
|
|
20010
|
+
return results;
|
|
20011
|
+
}
|
|
18580
20012
|
/**
|
|
18581
20013
|
* Get the value under a key.
|
|
18582
20014
|
* @remarks Expected time O(log n)
|
|
@@ -18728,6 +20160,26 @@ var _TreeMap = class _TreeMap {
|
|
|
18728
20160
|
|
|
18729
20161
|
|
|
18730
20162
|
|
|
20163
|
+
|
|
20164
|
+
|
|
20165
|
+
|
|
20166
|
+
|
|
20167
|
+
|
|
20168
|
+
|
|
20169
|
+
|
|
20170
|
+
|
|
20171
|
+
|
|
20172
|
+
|
|
20173
|
+
|
|
20174
|
+
|
|
20175
|
+
|
|
20176
|
+
|
|
20177
|
+
|
|
20178
|
+
|
|
20179
|
+
|
|
20180
|
+
|
|
20181
|
+
|
|
20182
|
+
|
|
18731
20183
|
|
|
18732
20184
|
|
|
18733
20185
|
|
|
@@ -18916,6 +20368,26 @@ var _TreeMap = class _TreeMap {
|
|
|
18916
20368
|
|
|
18917
20369
|
|
|
18918
20370
|
|
|
20371
|
+
|
|
20372
|
+
|
|
20373
|
+
|
|
20374
|
+
|
|
20375
|
+
|
|
20376
|
+
|
|
20377
|
+
|
|
20378
|
+
|
|
20379
|
+
|
|
20380
|
+
|
|
20381
|
+
|
|
20382
|
+
|
|
20383
|
+
|
|
20384
|
+
|
|
20385
|
+
|
|
20386
|
+
|
|
20387
|
+
|
|
20388
|
+
|
|
20389
|
+
|
|
20390
|
+
|
|
18919
20391
|
|
|
18920
20392
|
|
|
18921
20393
|
|
|
@@ -19104,6 +20576,26 @@ var _TreeMap = class _TreeMap {
|
|
|
19104
20576
|
|
|
19105
20577
|
|
|
19106
20578
|
|
|
20579
|
+
|
|
20580
|
+
|
|
20581
|
+
|
|
20582
|
+
|
|
20583
|
+
|
|
20584
|
+
|
|
20585
|
+
|
|
20586
|
+
|
|
20587
|
+
|
|
20588
|
+
|
|
20589
|
+
|
|
20590
|
+
|
|
20591
|
+
|
|
20592
|
+
|
|
20593
|
+
|
|
20594
|
+
|
|
20595
|
+
|
|
20596
|
+
|
|
20597
|
+
|
|
20598
|
+
|
|
19107
20599
|
|
|
19108
20600
|
|
|
19109
20601
|
|
|
@@ -19139,10 +20631,25 @@ var _TreeMap = class _TreeMap {
|
|
|
19139
20631
|
* console.log(sessions.size); // 2;
|
|
19140
20632
|
*/
|
|
19141
20633
|
delete(key) {
|
|
19142
|
-
var _a;
|
|
19143
20634
|
this._validateKey(key);
|
|
19144
|
-
|
|
19145
|
-
|
|
20635
|
+
return __privateGet(this, _core3).delete(key);
|
|
20636
|
+
}
|
|
20637
|
+
/**
|
|
20638
|
+
* Delete all entries matching a predicate.
|
|
20639
|
+
* @remarks Time O(N), Space O(N)
|
|
20640
|
+
* @param predicate - Function (key, value, index, map) → boolean; return true to delete.
|
|
20641
|
+
* @returns True if at least one entry was deleted.
|
|
20642
|
+
*/
|
|
20643
|
+
deleteWhere(predicate) {
|
|
20644
|
+
let deleted = false;
|
|
20645
|
+
let index = 0;
|
|
20646
|
+
for (const [key, value] of this) {
|
|
20647
|
+
if (predicate(key, value, index++, this)) {
|
|
20648
|
+
this.delete(key);
|
|
20649
|
+
deleted = true;
|
|
20650
|
+
}
|
|
20651
|
+
}
|
|
20652
|
+
return deleted;
|
|
19146
20653
|
}
|
|
19147
20654
|
/**
|
|
19148
20655
|
* Remove all entries.
|
|
@@ -19283,6 +20790,26 @@ var _TreeMap = class _TreeMap {
|
|
|
19283
20790
|
|
|
19284
20791
|
|
|
19285
20792
|
|
|
20793
|
+
|
|
20794
|
+
|
|
20795
|
+
|
|
20796
|
+
|
|
20797
|
+
|
|
20798
|
+
|
|
20799
|
+
|
|
20800
|
+
|
|
20801
|
+
|
|
20802
|
+
|
|
20803
|
+
|
|
20804
|
+
|
|
20805
|
+
|
|
20806
|
+
|
|
20807
|
+
|
|
20808
|
+
|
|
20809
|
+
|
|
20810
|
+
|
|
20811
|
+
|
|
20812
|
+
|
|
19286
20813
|
|
|
19287
20814
|
|
|
19288
20815
|
|
|
@@ -19452,6 +20979,26 @@ var _TreeMap = class _TreeMap {
|
|
|
19452
20979
|
|
|
19453
20980
|
|
|
19454
20981
|
|
|
20982
|
+
|
|
20983
|
+
|
|
20984
|
+
|
|
20985
|
+
|
|
20986
|
+
|
|
20987
|
+
|
|
20988
|
+
|
|
20989
|
+
|
|
20990
|
+
|
|
20991
|
+
|
|
20992
|
+
|
|
20993
|
+
|
|
20994
|
+
|
|
20995
|
+
|
|
20996
|
+
|
|
20997
|
+
|
|
20998
|
+
|
|
20999
|
+
|
|
21000
|
+
|
|
21001
|
+
|
|
19455
21002
|
|
|
19456
21003
|
|
|
19457
21004
|
|
|
@@ -19625,6 +21172,26 @@ var _TreeMap = class _TreeMap {
|
|
|
19625
21172
|
|
|
19626
21173
|
|
|
19627
21174
|
|
|
21175
|
+
|
|
21176
|
+
|
|
21177
|
+
|
|
21178
|
+
|
|
21179
|
+
|
|
21180
|
+
|
|
21181
|
+
|
|
21182
|
+
|
|
21183
|
+
|
|
21184
|
+
|
|
21185
|
+
|
|
21186
|
+
|
|
21187
|
+
|
|
21188
|
+
|
|
21189
|
+
|
|
21190
|
+
|
|
21191
|
+
|
|
21192
|
+
|
|
21193
|
+
|
|
21194
|
+
|
|
19628
21195
|
|
|
19629
21196
|
|
|
19630
21197
|
|
|
@@ -19795,6 +21362,26 @@ var _TreeMap = class _TreeMap {
|
|
|
19795
21362
|
|
|
19796
21363
|
|
|
19797
21364
|
|
|
21365
|
+
|
|
21366
|
+
|
|
21367
|
+
|
|
21368
|
+
|
|
21369
|
+
|
|
21370
|
+
|
|
21371
|
+
|
|
21372
|
+
|
|
21373
|
+
|
|
21374
|
+
|
|
21375
|
+
|
|
21376
|
+
|
|
21377
|
+
|
|
21378
|
+
|
|
21379
|
+
|
|
21380
|
+
|
|
21381
|
+
|
|
21382
|
+
|
|
21383
|
+
|
|
21384
|
+
|
|
19798
21385
|
|
|
19799
21386
|
|
|
19800
21387
|
|
|
@@ -19968,6 +21555,26 @@ var _TreeMap = class _TreeMap {
|
|
|
19968
21555
|
|
|
19969
21556
|
|
|
19970
21557
|
|
|
21558
|
+
|
|
21559
|
+
|
|
21560
|
+
|
|
21561
|
+
|
|
21562
|
+
|
|
21563
|
+
|
|
21564
|
+
|
|
21565
|
+
|
|
21566
|
+
|
|
21567
|
+
|
|
21568
|
+
|
|
21569
|
+
|
|
21570
|
+
|
|
21571
|
+
|
|
21572
|
+
|
|
21573
|
+
|
|
21574
|
+
|
|
21575
|
+
|
|
21576
|
+
|
|
21577
|
+
|
|
19971
21578
|
|
|
19972
21579
|
|
|
19973
21580
|
|
|
@@ -20141,6 +21748,26 @@ var _TreeMap = class _TreeMap {
|
|
|
20141
21748
|
|
|
20142
21749
|
|
|
20143
21750
|
|
|
21751
|
+
|
|
21752
|
+
|
|
21753
|
+
|
|
21754
|
+
|
|
21755
|
+
|
|
21756
|
+
|
|
21757
|
+
|
|
21758
|
+
|
|
21759
|
+
|
|
21760
|
+
|
|
21761
|
+
|
|
21762
|
+
|
|
21763
|
+
|
|
21764
|
+
|
|
21765
|
+
|
|
21766
|
+
|
|
21767
|
+
|
|
21768
|
+
|
|
21769
|
+
|
|
21770
|
+
|
|
20144
21771
|
|
|
20145
21772
|
|
|
20146
21773
|
|
|
@@ -20317,6 +21944,26 @@ var _TreeMap = class _TreeMap {
|
|
|
20317
21944
|
|
|
20318
21945
|
|
|
20319
21946
|
|
|
21947
|
+
|
|
21948
|
+
|
|
21949
|
+
|
|
21950
|
+
|
|
21951
|
+
|
|
21952
|
+
|
|
21953
|
+
|
|
21954
|
+
|
|
21955
|
+
|
|
21956
|
+
|
|
21957
|
+
|
|
21958
|
+
|
|
21959
|
+
|
|
21960
|
+
|
|
21961
|
+
|
|
21962
|
+
|
|
21963
|
+
|
|
21964
|
+
|
|
21965
|
+
|
|
21966
|
+
|
|
20320
21967
|
|
|
20321
21968
|
|
|
20322
21969
|
|
|
@@ -20493,6 +22140,26 @@ var _TreeMap = class _TreeMap {
|
|
|
20493
22140
|
|
|
20494
22141
|
|
|
20495
22142
|
|
|
22143
|
+
|
|
22144
|
+
|
|
22145
|
+
|
|
22146
|
+
|
|
22147
|
+
|
|
22148
|
+
|
|
22149
|
+
|
|
22150
|
+
|
|
22151
|
+
|
|
22152
|
+
|
|
22153
|
+
|
|
22154
|
+
|
|
22155
|
+
|
|
22156
|
+
|
|
22157
|
+
|
|
22158
|
+
|
|
22159
|
+
|
|
22160
|
+
|
|
22161
|
+
|
|
22162
|
+
|
|
20496
22163
|
|
|
20497
22164
|
|
|
20498
22165
|
|
|
@@ -20663,6 +22330,26 @@ var _TreeMap = class _TreeMap {
|
|
|
20663
22330
|
|
|
20664
22331
|
|
|
20665
22332
|
|
|
22333
|
+
|
|
22334
|
+
|
|
22335
|
+
|
|
22336
|
+
|
|
22337
|
+
|
|
22338
|
+
|
|
22339
|
+
|
|
22340
|
+
|
|
22341
|
+
|
|
22342
|
+
|
|
22343
|
+
|
|
22344
|
+
|
|
22345
|
+
|
|
22346
|
+
|
|
22347
|
+
|
|
22348
|
+
|
|
22349
|
+
|
|
22350
|
+
|
|
22351
|
+
|
|
22352
|
+
|
|
20666
22353
|
|
|
20667
22354
|
|
|
20668
22355
|
|
|
@@ -20835,6 +22522,26 @@ var _TreeMap = class _TreeMap {
|
|
|
20835
22522
|
|
|
20836
22523
|
|
|
20837
22524
|
|
|
22525
|
+
|
|
22526
|
+
|
|
22527
|
+
|
|
22528
|
+
|
|
22529
|
+
|
|
22530
|
+
|
|
22531
|
+
|
|
22532
|
+
|
|
22533
|
+
|
|
22534
|
+
|
|
22535
|
+
|
|
22536
|
+
|
|
22537
|
+
|
|
22538
|
+
|
|
22539
|
+
|
|
22540
|
+
|
|
22541
|
+
|
|
22542
|
+
|
|
22543
|
+
|
|
22544
|
+
|
|
20838
22545
|
|
|
20839
22546
|
|
|
20840
22547
|
|
|
@@ -21008,6 +22715,26 @@ var _TreeMap = class _TreeMap {
|
|
|
21008
22715
|
|
|
21009
22716
|
|
|
21010
22717
|
|
|
22718
|
+
|
|
22719
|
+
|
|
22720
|
+
|
|
22721
|
+
|
|
22722
|
+
|
|
22723
|
+
|
|
22724
|
+
|
|
22725
|
+
|
|
22726
|
+
|
|
22727
|
+
|
|
22728
|
+
|
|
22729
|
+
|
|
22730
|
+
|
|
22731
|
+
|
|
22732
|
+
|
|
22733
|
+
|
|
22734
|
+
|
|
22735
|
+
|
|
22736
|
+
|
|
22737
|
+
|
|
21011
22738
|
|
|
21012
22739
|
|
|
21013
22740
|
|
|
@@ -21182,6 +22909,26 @@ var _TreeMap = class _TreeMap {
|
|
|
21182
22909
|
|
|
21183
22910
|
|
|
21184
22911
|
|
|
22912
|
+
|
|
22913
|
+
|
|
22914
|
+
|
|
22915
|
+
|
|
22916
|
+
|
|
22917
|
+
|
|
22918
|
+
|
|
22919
|
+
|
|
22920
|
+
|
|
22921
|
+
|
|
22922
|
+
|
|
22923
|
+
|
|
22924
|
+
|
|
22925
|
+
|
|
22926
|
+
|
|
22927
|
+
|
|
22928
|
+
|
|
22929
|
+
|
|
22930
|
+
|
|
22931
|
+
|
|
21185
22932
|
|
|
21186
22933
|
|
|
21187
22934
|
|
|
@@ -21351,6 +23098,26 @@ var _TreeMap = class _TreeMap {
|
|
|
21351
23098
|
|
|
21352
23099
|
|
|
21353
23100
|
|
|
23101
|
+
|
|
23102
|
+
|
|
23103
|
+
|
|
23104
|
+
|
|
23105
|
+
|
|
23106
|
+
|
|
23107
|
+
|
|
23108
|
+
|
|
23109
|
+
|
|
23110
|
+
|
|
23111
|
+
|
|
23112
|
+
|
|
23113
|
+
|
|
23114
|
+
|
|
23115
|
+
|
|
23116
|
+
|
|
23117
|
+
|
|
23118
|
+
|
|
23119
|
+
|
|
23120
|
+
|
|
21354
23121
|
|
|
21355
23122
|
|
|
21356
23123
|
|
|
@@ -21414,6 +23181,10 @@ var _TreeMap = class _TreeMap {
|
|
|
21414
23181
|
|
|
21415
23182
|
|
|
21416
23183
|
|
|
23184
|
+
|
|
23185
|
+
|
|
23186
|
+
|
|
23187
|
+
|
|
21417
23188
|
|
|
21418
23189
|
|
|
21419
23190
|
|
|
@@ -21482,6 +23253,10 @@ var _TreeMap = class _TreeMap {
|
|
|
21482
23253
|
|
|
21483
23254
|
|
|
21484
23255
|
|
|
23256
|
+
|
|
23257
|
+
|
|
23258
|
+
|
|
23259
|
+
|
|
21485
23260
|
|
|
21486
23261
|
|
|
21487
23262
|
|
|
@@ -21534,6 +23309,10 @@ var _TreeMap = class _TreeMap {
|
|
|
21534
23309
|
|
|
21535
23310
|
|
|
21536
23311
|
|
|
23312
|
+
|
|
23313
|
+
|
|
23314
|
+
|
|
23315
|
+
|
|
21537
23316
|
|
|
21538
23317
|
|
|
21539
23318
|
|
|
@@ -21590,6 +23369,10 @@ var _TreeMap = class _TreeMap {
|
|
|
21590
23369
|
|
|
21591
23370
|
|
|
21592
23371
|
|
|
23372
|
+
|
|
23373
|
+
|
|
23374
|
+
|
|
23375
|
+
|
|
21593
23376
|
|
|
21594
23377
|
|
|
21595
23378
|
|
|
@@ -21733,6 +23516,22 @@ var _TreeMap = class _TreeMap {
|
|
|
21733
23516
|
|
|
21734
23517
|
|
|
21735
23518
|
|
|
23519
|
+
|
|
23520
|
+
|
|
23521
|
+
|
|
23522
|
+
|
|
23523
|
+
|
|
23524
|
+
|
|
23525
|
+
|
|
23526
|
+
|
|
23527
|
+
|
|
23528
|
+
|
|
23529
|
+
|
|
23530
|
+
|
|
23531
|
+
|
|
23532
|
+
|
|
23533
|
+
|
|
23534
|
+
|
|
21736
23535
|
|
|
21737
23536
|
|
|
21738
23537
|
|
|
@@ -21906,6 +23705,22 @@ var _TreeMap = class _TreeMap {
|
|
|
21906
23705
|
|
|
21907
23706
|
|
|
21908
23707
|
|
|
23708
|
+
|
|
23709
|
+
|
|
23710
|
+
|
|
23711
|
+
|
|
23712
|
+
|
|
23713
|
+
|
|
23714
|
+
|
|
23715
|
+
|
|
23716
|
+
|
|
23717
|
+
|
|
23718
|
+
|
|
23719
|
+
|
|
23720
|
+
|
|
23721
|
+
|
|
23722
|
+
|
|
23723
|
+
|
|
21909
23724
|
|
|
21910
23725
|
|
|
21911
23726
|
|
|
@@ -22063,6 +23878,22 @@ var _TreeMap = class _TreeMap {
|
|
|
22063
23878
|
|
|
22064
23879
|
|
|
22065
23880
|
|
|
23881
|
+
|
|
23882
|
+
|
|
23883
|
+
|
|
23884
|
+
|
|
23885
|
+
|
|
23886
|
+
|
|
23887
|
+
|
|
23888
|
+
|
|
23889
|
+
|
|
23890
|
+
|
|
23891
|
+
|
|
23892
|
+
|
|
23893
|
+
|
|
23894
|
+
|
|
23895
|
+
|
|
23896
|
+
|
|
22066
23897
|
|
|
22067
23898
|
|
|
22068
23899
|
|
|
@@ -22220,6 +24051,22 @@ var _TreeMap = class _TreeMap {
|
|
|
22220
24051
|
|
|
22221
24052
|
|
|
22222
24053
|
|
|
24054
|
+
|
|
24055
|
+
|
|
24056
|
+
|
|
24057
|
+
|
|
24058
|
+
|
|
24059
|
+
|
|
24060
|
+
|
|
24061
|
+
|
|
24062
|
+
|
|
24063
|
+
|
|
24064
|
+
|
|
24065
|
+
|
|
24066
|
+
|
|
24067
|
+
|
|
24068
|
+
|
|
24069
|
+
|
|
22223
24070
|
|
|
22224
24071
|
|
|
22225
24072
|
|
|
@@ -22378,6 +24225,22 @@ var _TreeMap = class _TreeMap {
|
|
|
22378
24225
|
|
|
22379
24226
|
|
|
22380
24227
|
|
|
24228
|
+
|
|
24229
|
+
|
|
24230
|
+
|
|
24231
|
+
|
|
24232
|
+
|
|
24233
|
+
|
|
24234
|
+
|
|
24235
|
+
|
|
24236
|
+
|
|
24237
|
+
|
|
24238
|
+
|
|
24239
|
+
|
|
24240
|
+
|
|
24241
|
+
|
|
24242
|
+
|
|
24243
|
+
|
|
22381
24244
|
|
|
22382
24245
|
|
|
22383
24246
|
|
|
@@ -22485,8 +24348,16 @@ var _TreeMap = class _TreeMap {
|
|
|
22485
24348
|
* Returns keys by rank range (0-indexed, inclusive on both ends).
|
|
22486
24349
|
* @remarks Time O(log n + k). Requires `enableOrderStatistic: true`.
|
|
22487
24350
|
|
|
24351
|
+
|
|
24352
|
+
|
|
24353
|
+
|
|
24354
|
+
|
|
24355
|
+
|
|
24356
|
+
|
|
24357
|
+
|
|
24358
|
+
|
|
22488
24359
|
* @example
|
|
22489
|
-
* // Pagination
|
|
24360
|
+
* // Pagination by position in tree order
|
|
22490
24361
|
* const tree = new TreeMap<number>(
|
|
22491
24362
|
* [10, 20, 30, 40, 50, 60, 70, 80, 90],
|
|
22492
24363
|
* { enableOrderStatistic: true }
|
|
@@ -22645,6 +24516,26 @@ var _TreeMap = class _TreeMap {
|
|
|
22645
24516
|
|
|
22646
24517
|
|
|
22647
24518
|
|
|
24519
|
+
|
|
24520
|
+
|
|
24521
|
+
|
|
24522
|
+
|
|
24523
|
+
|
|
24524
|
+
|
|
24525
|
+
|
|
24526
|
+
|
|
24527
|
+
|
|
24528
|
+
|
|
24529
|
+
|
|
24530
|
+
|
|
24531
|
+
|
|
24532
|
+
|
|
24533
|
+
|
|
24534
|
+
|
|
24535
|
+
|
|
24536
|
+
|
|
24537
|
+
|
|
24538
|
+
|
|
22648
24539
|
|
|
22649
24540
|
|
|
22650
24541
|
|
|
@@ -22772,6 +24663,10 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
22772
24663
|
|
|
22773
24664
|
|
|
22774
24665
|
|
|
24666
|
+
|
|
24667
|
+
|
|
24668
|
+
|
|
24669
|
+
|
|
22775
24670
|
|
|
22776
24671
|
|
|
22777
24672
|
|
|
@@ -22927,6 +24822,26 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
22927
24822
|
|
|
22928
24823
|
|
|
22929
24824
|
|
|
24825
|
+
|
|
24826
|
+
|
|
24827
|
+
|
|
24828
|
+
|
|
24829
|
+
|
|
24830
|
+
|
|
24831
|
+
|
|
24832
|
+
|
|
24833
|
+
|
|
24834
|
+
|
|
24835
|
+
|
|
24836
|
+
|
|
24837
|
+
|
|
24838
|
+
|
|
24839
|
+
|
|
24840
|
+
|
|
24841
|
+
|
|
24842
|
+
|
|
24843
|
+
|
|
24844
|
+
|
|
22930
24845
|
|
|
22931
24846
|
|
|
22932
24847
|
|
|
@@ -23098,6 +25013,26 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
23098
25013
|
|
|
23099
25014
|
|
|
23100
25015
|
|
|
25016
|
+
|
|
25017
|
+
|
|
25018
|
+
|
|
25019
|
+
|
|
25020
|
+
|
|
25021
|
+
|
|
25022
|
+
|
|
25023
|
+
|
|
25024
|
+
|
|
25025
|
+
|
|
25026
|
+
|
|
25027
|
+
|
|
25028
|
+
|
|
25029
|
+
|
|
25030
|
+
|
|
25031
|
+
|
|
25032
|
+
|
|
25033
|
+
|
|
25034
|
+
|
|
25035
|
+
|
|
23101
25036
|
|
|
23102
25037
|
|
|
23103
25038
|
|
|
@@ -23154,6 +25089,10 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
23154
25089
|
|
|
23155
25090
|
|
|
23156
25091
|
|
|
25092
|
+
|
|
25093
|
+
|
|
25094
|
+
|
|
25095
|
+
|
|
23157
25096
|
|
|
23158
25097
|
|
|
23159
25098
|
|
|
@@ -23305,6 +25244,26 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
23305
25244
|
|
|
23306
25245
|
|
|
23307
25246
|
|
|
25247
|
+
|
|
25248
|
+
|
|
25249
|
+
|
|
25250
|
+
|
|
25251
|
+
|
|
25252
|
+
|
|
25253
|
+
|
|
25254
|
+
|
|
25255
|
+
|
|
25256
|
+
|
|
25257
|
+
|
|
25258
|
+
|
|
25259
|
+
|
|
25260
|
+
|
|
25261
|
+
|
|
25262
|
+
|
|
25263
|
+
|
|
25264
|
+
|
|
25265
|
+
|
|
25266
|
+
|
|
23308
25267
|
|
|
23309
25268
|
|
|
23310
25269
|
|
|
@@ -23371,6 +25330,10 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
23371
25330
|
|
|
23372
25331
|
|
|
23373
25332
|
|
|
25333
|
+
|
|
25334
|
+
|
|
25335
|
+
|
|
25336
|
+
|
|
23374
25337
|
|
|
23375
25338
|
|
|
23376
25339
|
|
|
@@ -23540,6 +25503,26 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
23540
25503
|
|
|
23541
25504
|
|
|
23542
25505
|
|
|
25506
|
+
|
|
25507
|
+
|
|
25508
|
+
|
|
25509
|
+
|
|
25510
|
+
|
|
25511
|
+
|
|
25512
|
+
|
|
25513
|
+
|
|
25514
|
+
|
|
25515
|
+
|
|
25516
|
+
|
|
25517
|
+
|
|
25518
|
+
|
|
25519
|
+
|
|
25520
|
+
|
|
25521
|
+
|
|
25522
|
+
|
|
25523
|
+
|
|
25524
|
+
|
|
25525
|
+
|
|
23543
25526
|
|
|
23544
25527
|
|
|
23545
25528
|
|
|
@@ -23607,6 +25590,10 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
23607
25590
|
|
|
23608
25591
|
|
|
23609
25592
|
|
|
25593
|
+
|
|
25594
|
+
|
|
25595
|
+
|
|
25596
|
+
|
|
23610
25597
|
|
|
23611
25598
|
|
|
23612
25599
|
|
|
@@ -23652,6 +25639,10 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
23652
25639
|
|
|
23653
25640
|
|
|
23654
25641
|
|
|
25642
|
+
|
|
25643
|
+
|
|
25644
|
+
|
|
25645
|
+
|
|
23655
25646
|
|
|
23656
25647
|
|
|
23657
25648
|
|
|
@@ -23807,6 +25798,26 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
23807
25798
|
|
|
23808
25799
|
|
|
23809
25800
|
|
|
25801
|
+
|
|
25802
|
+
|
|
25803
|
+
|
|
25804
|
+
|
|
25805
|
+
|
|
25806
|
+
|
|
25807
|
+
|
|
25808
|
+
|
|
25809
|
+
|
|
25810
|
+
|
|
25811
|
+
|
|
25812
|
+
|
|
25813
|
+
|
|
25814
|
+
|
|
25815
|
+
|
|
25816
|
+
|
|
25817
|
+
|
|
25818
|
+
|
|
25819
|
+
|
|
25820
|
+
|
|
23810
25821
|
|
|
23811
25822
|
|
|
23812
25823
|
|
|
@@ -23988,6 +25999,26 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
23988
25999
|
|
|
23989
26000
|
|
|
23990
26001
|
|
|
26002
|
+
|
|
26003
|
+
|
|
26004
|
+
|
|
26005
|
+
|
|
26006
|
+
|
|
26007
|
+
|
|
26008
|
+
|
|
26009
|
+
|
|
26010
|
+
|
|
26011
|
+
|
|
26012
|
+
|
|
26013
|
+
|
|
26014
|
+
|
|
26015
|
+
|
|
26016
|
+
|
|
26017
|
+
|
|
26018
|
+
|
|
26019
|
+
|
|
26020
|
+
|
|
26021
|
+
|
|
23991
26022
|
|
|
23992
26023
|
|
|
23993
26024
|
|
|
@@ -24043,6 +26074,10 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
24043
26074
|
|
|
24044
26075
|
|
|
24045
26076
|
|
|
26077
|
+
|
|
26078
|
+
|
|
26079
|
+
|
|
26080
|
+
|
|
24046
26081
|
|
|
24047
26082
|
|
|
24048
26083
|
|
|
@@ -24082,6 +26117,10 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
24082
26117
|
|
|
24083
26118
|
|
|
24084
26119
|
|
|
26120
|
+
|
|
26121
|
+
|
|
26122
|
+
|
|
26123
|
+
|
|
24085
26124
|
|
|
24086
26125
|
|
|
24087
26126
|
|
|
@@ -24246,6 +26285,26 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
24246
26285
|
|
|
24247
26286
|
|
|
24248
26287
|
|
|
26288
|
+
|
|
26289
|
+
|
|
26290
|
+
|
|
26291
|
+
|
|
26292
|
+
|
|
26293
|
+
|
|
26294
|
+
|
|
26295
|
+
|
|
26296
|
+
|
|
26297
|
+
|
|
26298
|
+
|
|
26299
|
+
|
|
26300
|
+
|
|
26301
|
+
|
|
26302
|
+
|
|
26303
|
+
|
|
26304
|
+
|
|
26305
|
+
|
|
26306
|
+
|
|
26307
|
+
|
|
24249
26308
|
|
|
24250
26309
|
|
|
24251
26310
|
|
|
@@ -24304,6 +26363,10 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
24304
26363
|
|
|
24305
26364
|
|
|
24306
26365
|
|
|
26366
|
+
|
|
26367
|
+
|
|
26368
|
+
|
|
26369
|
+
|
|
24307
26370
|
|
|
24308
26371
|
|
|
24309
26372
|
|
|
@@ -24344,6 +26407,10 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
24344
26407
|
|
|
24345
26408
|
|
|
24346
26409
|
|
|
26410
|
+
|
|
26411
|
+
|
|
26412
|
+
|
|
26413
|
+
|
|
24347
26414
|
|
|
24348
26415
|
|
|
24349
26416
|
|
|
@@ -24384,6 +26451,10 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
24384
26451
|
|
|
24385
26452
|
|
|
24386
26453
|
|
|
26454
|
+
|
|
26455
|
+
|
|
26456
|
+
|
|
26457
|
+
|
|
24387
26458
|
|
|
24388
26459
|
|
|
24389
26460
|
|
|
@@ -24428,6 +26499,10 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
24428
26499
|
|
|
24429
26500
|
|
|
24430
26501
|
|
|
26502
|
+
|
|
26503
|
+
|
|
26504
|
+
|
|
26505
|
+
|
|
24431
26506
|
|
|
24432
26507
|
|
|
24433
26508
|
|
|
@@ -24558,6 +26633,22 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
24558
26633
|
|
|
24559
26634
|
|
|
24560
26635
|
|
|
26636
|
+
|
|
26637
|
+
|
|
26638
|
+
|
|
26639
|
+
|
|
26640
|
+
|
|
26641
|
+
|
|
26642
|
+
|
|
26643
|
+
|
|
26644
|
+
|
|
26645
|
+
|
|
26646
|
+
|
|
26647
|
+
|
|
26648
|
+
|
|
26649
|
+
|
|
26650
|
+
|
|
26651
|
+
|
|
24561
26652
|
|
|
24562
26653
|
|
|
24563
26654
|
|
|
@@ -24699,6 +26790,22 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
24699
26790
|
|
|
24700
26791
|
|
|
24701
26792
|
|
|
26793
|
+
|
|
26794
|
+
|
|
26795
|
+
|
|
26796
|
+
|
|
26797
|
+
|
|
26798
|
+
|
|
26799
|
+
|
|
26800
|
+
|
|
26801
|
+
|
|
26802
|
+
|
|
26803
|
+
|
|
26804
|
+
|
|
26805
|
+
|
|
26806
|
+
|
|
26807
|
+
|
|
26808
|
+
|
|
24702
26809
|
|
|
24703
26810
|
|
|
24704
26811
|
|
|
@@ -24840,6 +26947,22 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
24840
26947
|
|
|
24841
26948
|
|
|
24842
26949
|
|
|
26950
|
+
|
|
26951
|
+
|
|
26952
|
+
|
|
26953
|
+
|
|
26954
|
+
|
|
26955
|
+
|
|
26956
|
+
|
|
26957
|
+
|
|
26958
|
+
|
|
26959
|
+
|
|
26960
|
+
|
|
26961
|
+
|
|
26962
|
+
|
|
26963
|
+
|
|
26964
|
+
|
|
26965
|
+
|
|
24843
26966
|
|
|
24844
26967
|
|
|
24845
26968
|
|
|
@@ -24980,6 +27103,22 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
24980
27103
|
|
|
24981
27104
|
|
|
24982
27105
|
|
|
27106
|
+
|
|
27107
|
+
|
|
27108
|
+
|
|
27109
|
+
|
|
27110
|
+
|
|
27111
|
+
|
|
27112
|
+
|
|
27113
|
+
|
|
27114
|
+
|
|
27115
|
+
|
|
27116
|
+
|
|
27117
|
+
|
|
27118
|
+
|
|
27119
|
+
|
|
27120
|
+
|
|
27121
|
+
|
|
24983
27122
|
|
|
24984
27123
|
|
|
24985
27124
|
|
|
@@ -25150,6 +27289,26 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
25150
27289
|
|
|
25151
27290
|
|
|
25152
27291
|
|
|
27292
|
+
|
|
27293
|
+
|
|
27294
|
+
|
|
27295
|
+
|
|
27296
|
+
|
|
27297
|
+
|
|
27298
|
+
|
|
27299
|
+
|
|
27300
|
+
|
|
27301
|
+
|
|
27302
|
+
|
|
27303
|
+
|
|
27304
|
+
|
|
27305
|
+
|
|
27306
|
+
|
|
27307
|
+
|
|
27308
|
+
|
|
27309
|
+
|
|
27310
|
+
|
|
27311
|
+
|
|
25153
27312
|
|
|
25154
27313
|
|
|
25155
27314
|
|
|
@@ -25326,6 +27485,26 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
25326
27485
|
|
|
25327
27486
|
|
|
25328
27487
|
|
|
27488
|
+
|
|
27489
|
+
|
|
27490
|
+
|
|
27491
|
+
|
|
27492
|
+
|
|
27493
|
+
|
|
27494
|
+
|
|
27495
|
+
|
|
27496
|
+
|
|
27497
|
+
|
|
27498
|
+
|
|
27499
|
+
|
|
27500
|
+
|
|
27501
|
+
|
|
27502
|
+
|
|
27503
|
+
|
|
27504
|
+
|
|
27505
|
+
|
|
27506
|
+
|
|
27507
|
+
|
|
25329
27508
|
|
|
25330
27509
|
|
|
25331
27510
|
|
|
@@ -25509,6 +27688,26 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
25509
27688
|
|
|
25510
27689
|
|
|
25511
27690
|
|
|
27691
|
+
|
|
27692
|
+
|
|
27693
|
+
|
|
27694
|
+
|
|
27695
|
+
|
|
27696
|
+
|
|
27697
|
+
|
|
27698
|
+
|
|
27699
|
+
|
|
27700
|
+
|
|
27701
|
+
|
|
27702
|
+
|
|
27703
|
+
|
|
27704
|
+
|
|
27705
|
+
|
|
27706
|
+
|
|
27707
|
+
|
|
27708
|
+
|
|
27709
|
+
|
|
27710
|
+
|
|
25512
27711
|
|
|
25513
27712
|
|
|
25514
27713
|
|
|
@@ -25687,6 +27886,26 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
25687
27886
|
|
|
25688
27887
|
|
|
25689
27888
|
|
|
27889
|
+
|
|
27890
|
+
|
|
27891
|
+
|
|
27892
|
+
|
|
27893
|
+
|
|
27894
|
+
|
|
27895
|
+
|
|
27896
|
+
|
|
27897
|
+
|
|
27898
|
+
|
|
27899
|
+
|
|
27900
|
+
|
|
27901
|
+
|
|
27902
|
+
|
|
27903
|
+
|
|
27904
|
+
|
|
27905
|
+
|
|
27906
|
+
|
|
27907
|
+
|
|
27908
|
+
|
|
25690
27909
|
|
|
25691
27910
|
|
|
25692
27911
|
|
|
@@ -25917,8 +28136,16 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
25917
28136
|
/**
|
|
25918
28137
|
* Get elements by rank range
|
|
25919
28138
|
|
|
28139
|
+
|
|
28140
|
+
|
|
28141
|
+
|
|
28142
|
+
|
|
28143
|
+
|
|
28144
|
+
|
|
28145
|
+
|
|
28146
|
+
|
|
25920
28147
|
* @example
|
|
25921
|
-
* // Pagination
|
|
28148
|
+
* // Pagination by position in tree order
|
|
25922
28149
|
* const tree = new TreeMultiSet<number>(
|
|
25923
28150
|
* [10, 20, 30, 40, 50, 60, 70, 80, 90],
|
|
25924
28151
|
* { enableOrderStatistic: true }
|
|
@@ -25940,6 +28167,26 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
25940
28167
|
|
|
25941
28168
|
|
|
25942
28169
|
|
|
28170
|
+
|
|
28171
|
+
|
|
28172
|
+
|
|
28173
|
+
|
|
28174
|
+
|
|
28175
|
+
|
|
28176
|
+
|
|
28177
|
+
|
|
28178
|
+
|
|
28179
|
+
|
|
28180
|
+
|
|
28181
|
+
|
|
28182
|
+
|
|
28183
|
+
|
|
28184
|
+
|
|
28185
|
+
|
|
28186
|
+
|
|
28187
|
+
|
|
28188
|
+
|
|
28189
|
+
|
|
25943
28190
|
|
|
25944
28191
|
* @example
|
|
25945
28192
|
* // Deep clone
|
|
@@ -26072,6 +28319,22 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
26072
28319
|
|
|
26073
28320
|
|
|
26074
28321
|
|
|
28322
|
+
|
|
28323
|
+
|
|
28324
|
+
|
|
28325
|
+
|
|
28326
|
+
|
|
28327
|
+
|
|
28328
|
+
|
|
28329
|
+
|
|
28330
|
+
|
|
28331
|
+
|
|
28332
|
+
|
|
28333
|
+
|
|
28334
|
+
|
|
28335
|
+
|
|
28336
|
+
|
|
28337
|
+
|
|
26075
28338
|
|
|
26076
28339
|
|
|
26077
28340
|
|
|
@@ -26243,6 +28506,26 @@ var _TreeMultiSet = class _TreeMultiSet {
|
|
|
26243
28506
|
|
|
26244
28507
|
|
|
26245
28508
|
|
|
28509
|
+
|
|
28510
|
+
|
|
28511
|
+
|
|
28512
|
+
|
|
28513
|
+
|
|
28514
|
+
|
|
28515
|
+
|
|
28516
|
+
|
|
28517
|
+
|
|
28518
|
+
|
|
28519
|
+
|
|
28520
|
+
|
|
28521
|
+
|
|
28522
|
+
|
|
28523
|
+
|
|
28524
|
+
|
|
28525
|
+
|
|
28526
|
+
|
|
28527
|
+
|
|
28528
|
+
|
|
26246
28529
|
|
|
26247
28530
|
|
|
26248
28531
|
|