data-structure-typed 2.5.0 → 2.5.1
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/.vitepress/cache/deps_temp_51f5f1b0/chunk-7OIKW5WK.js +12984 -0
- package/.vitepress/cache/deps_temp_51f5f1b0/package.json +3 -0
- package/.vitepress/cache/deps_temp_51f5f1b0/vitepress___@vue_devtools-api.js +4505 -0
- package/.vitepress/cache/deps_temp_51f5f1b0/vitepress___@vueuse_core.js +9731 -0
- package/.vitepress/cache/deps_temp_51f5f1b0/vue.js +347 -0
- package/CHANGELOG.md +3 -1
- package/README.md +63 -26
- package/dist/cjs/binary-tree.cjs +23698 -0
- package/dist/cjs/graph.cjs +5236 -0
- package/dist/cjs/hash.cjs +1262 -0
- package/dist/cjs/heap.cjs +1540 -0
- package/dist/cjs/index.cjs +28244 -14795
- package/dist/cjs/linked-list.cjs +4370 -0
- package/dist/cjs/matrix.cjs +1042 -0
- package/dist/cjs/priority-queue.cjs +1314 -0
- package/dist/cjs/queue.cjs +4090 -0
- package/dist/cjs/stack.cjs +861 -0
- package/dist/cjs/trie.cjs +1173 -0
- package/dist/cjs-legacy/binary-tree.cjs +23730 -0
- package/dist/cjs-legacy/graph.cjs +5234 -0
- package/dist/cjs-legacy/hash.cjs +1262 -0
- package/dist/cjs-legacy/heap.cjs +1537 -0
- package/dist/cjs-legacy/index.cjs +28239 -14790
- package/dist/cjs-legacy/linked-list.cjs +4376 -0
- package/dist/cjs-legacy/matrix.cjs +1045 -0
- package/dist/cjs-legacy/priority-queue.cjs +1312 -0
- package/dist/cjs-legacy/queue.cjs +4088 -0
- package/dist/cjs-legacy/stack.cjs +861 -0
- package/dist/cjs-legacy/trie.cjs +1172 -0
- package/dist/esm/binary-tree.mjs +23683 -0
- package/dist/esm/graph.mjs +5223 -0
- package/dist/esm/hash.mjs +1259 -0
- package/dist/esm/heap.mjs +1534 -0
- package/dist/esm/index.mjs +28242 -14796
- package/dist/esm/linked-list.mjs +4363 -0
- package/dist/esm/matrix.mjs +1038 -0
- package/dist/esm/priority-queue.mjs +1310 -0
- package/dist/esm/queue.mjs +4086 -0
- package/dist/esm/stack.mjs +859 -0
- package/dist/esm/trie.mjs +1170 -0
- package/dist/esm-legacy/binary-tree.mjs +23715 -0
- package/dist/esm-legacy/graph.mjs +5221 -0
- package/dist/esm-legacy/hash.mjs +1259 -0
- package/dist/esm-legacy/heap.mjs +1531 -0
- package/dist/esm-legacy/index.mjs +28237 -14791
- package/dist/esm-legacy/linked-list.mjs +4369 -0
- package/dist/esm-legacy/matrix.mjs +1041 -0
- package/dist/esm-legacy/priority-queue.mjs +1308 -0
- package/dist/esm-legacy/queue.mjs +4084 -0
- package/dist/esm-legacy/stack.mjs +859 -0
- package/dist/esm-legacy/trie.mjs +1169 -0
- package/dist/types/data-structures/base/index.d.ts +1 -0
- package/dist/types/data-structures/base/iterable-entry-base.d.ts +8 -8
- package/dist/types/data-structures/base/linear-base.d.ts +3 -3
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +240 -0
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +280 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +502 -2
- package/dist/types/data-structures/binary-tree/bst.d.ts +481 -1
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +380 -0
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +120 -1
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +2764 -384
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +2753 -353
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +2241 -321
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +2554 -274
- package/dist/types/data-structures/graph/abstract-graph.d.ts +4 -4
- package/dist/types/data-structures/graph/directed-graph.d.ts +200 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +180 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +230 -10
- package/dist/types/data-structures/heap/heap.d.ts +280 -0
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +343 -3
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +303 -3
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +362 -2
- package/dist/types/data-structures/matrix/matrix.d.ts +160 -0
- package/dist/types/data-structures/queue/deque.d.ts +304 -4
- package/dist/types/data-structures/queue/queue.d.ts +240 -0
- package/dist/types/data-structures/stack/stack.d.ts +200 -0
- package/dist/types/data-structures/trie/trie.d.ts +244 -4
- package/dist/types/interfaces/graph.d.ts +1 -1
- package/dist/types/types/common.d.ts +2 -2
- package/dist/types/types/data-structures/heap/heap.d.ts +1 -0
- package/dist/types/types/data-structures/priority-queue/priority-queue.d.ts +1 -0
- package/dist/types/types/utils/validate-type.d.ts +4 -4
- package/dist/umd/data-structure-typed.js +28022 -14573
- package/dist/umd/data-structure-typed.min.js +9 -3
- package/docs-site-docusaurus/README.md +41 -0
- package/docs-site-docusaurus/docs/api/README.md +52 -0
- package/docs-site-docusaurus/docs/api/classes/AVLTree.md +6130 -0
- package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +282 -0
- package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +2266 -0
- package/docs-site-docusaurus/docs/api/classes/BST.md +5831 -0
- package/docs-site-docusaurus/docs/api/classes/BSTNode.md +333 -0
- package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +455 -0
- package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +4647 -0
- package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +331 -0
- package/docs-site-docusaurus/docs/api/classes/Deque.md +2767 -0
- package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +2999 -0
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +2685 -0
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedListNode.md +221 -0
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +253 -0
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +21 -0
- package/docs-site-docusaurus/docs/api/classes/HashMap.md +1333 -0
- package/docs-site-docusaurus/docs/api/classes/Heap.md +1881 -0
- package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +800 -0
- package/docs-site-docusaurus/docs/api/classes/IterableEntryBase.md +644 -0
- package/docs-site-docusaurus/docs/api/classes/LinearBase.md +1632 -0
- package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +1853 -0
- package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +1108 -0
- package/docs-site-docusaurus/docs/api/classes/LinkedListNode.md +156 -0
- package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +2824 -0
- package/docs-site-docusaurus/docs/api/classes/MapGraph.md +2929 -0
- package/docs-site-docusaurus/docs/api/classes/Matrix.md +1026 -0
- package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +1866 -0
- package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +1883 -0
- package/docs-site-docusaurus/docs/api/classes/MinHeap.md +1879 -0
- package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +1882 -0
- package/docs-site-docusaurus/docs/api/classes/Navigator.md +109 -0
- package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +1839 -0
- package/docs-site-docusaurus/docs/api/classes/Queue.md +2244 -0
- package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +6374 -0
- package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +372 -0
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +2897 -0
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +169 -0
- package/docs-site-docusaurus/docs/api/classes/SkipList.md +1229 -0
- package/docs-site-docusaurus/docs/api/classes/Stack.md +1573 -0
- package/docs-site-docusaurus/docs/api/classes/TreeMap.md +1257 -0
- package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +1475 -0
- package/docs-site-docusaurus/docs/api/classes/TreeSet.md +1117 -0
- package/docs-site-docusaurus/docs/api/classes/Trie.md +1708 -0
- package/docs-site-docusaurus/docs/api/classes/TrieNode.md +199 -0
- package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +2979 -0
- package/docs-site-docusaurus/docs/guide/_category_.json +6 -0
- package/docs-site-docusaurus/docs/guide/architecture.md +613 -0
- package/docs-site-docusaurus/docs/guide/concepts.md +420 -0
- package/docs-site-docusaurus/docs/guide/guides.md +611 -0
- package/docs-site-docusaurus/docs/guide/installation.md +60 -0
- package/docs-site-docusaurus/docs/guide/integrations.md +823 -0
- package/docs-site-docusaurus/docs/guide/overview.md +638 -0
- package/docs-site-docusaurus/docs/guide/performance.md +833 -0
- package/docs-site-docusaurus/docs/guide/quick-start.md +73 -0
- package/docs-site-docusaurus/docusaurus.config.ts +159 -0
- package/docs-site-docusaurus/fix-mdx-generics.mjs +75 -0
- package/docs-site-docusaurus/package-lock.json +18667 -0
- package/docs-site-docusaurus/package.json +50 -0
- package/docs-site-docusaurus/prefix-class-to-methods.mjs +48 -0
- package/docs-site-docusaurus/sidebars.ts +23 -0
- package/docs-site-docusaurus/sort-protected.mjs +87 -0
- package/docs-site-docusaurus/src/css/custom.css +96 -0
- package/docs-site-docusaurus/src/pages/index.module.css +13 -0
- package/docs-site-docusaurus/src/pages/index.tsx +71 -0
- package/docs-site-docusaurus/src/pages/markdown-page.md +7 -0
- package/docs-site-docusaurus/src/theme/TOCItems/index.tsx +34 -0
- package/docs-site-docusaurus/static/.nojekyll +0 -0
- package/docs-site-docusaurus/static/img/docusaurus-social-card.jpg +0 -0
- package/docs-site-docusaurus/static/img/docusaurus.png +0 -0
- package/docs-site-docusaurus/static/img/favicon.ico +0 -0
- package/docs-site-docusaurus/static/img/favicon.png +0 -0
- package/docs-site-docusaurus/static/img/logo-180.png +0 -0
- package/docs-site-docusaurus/static/img/logo.jpg +0 -0
- package/docs-site-docusaurus/static/img/logo.png +0 -0
- package/docs-site-docusaurus/static/img/logo.svg +1 -0
- package/docs-site-docusaurus/static/img/og-image.png +0 -0
- package/docs-site-docusaurus/static/img/undraw_docusaurus_mountain.svg +171 -0
- package/docs-site-docusaurus/static/img/undraw_docusaurus_react.svg +170 -0
- package/docs-site-docusaurus/static/img/undraw_docusaurus_tree.svg +40 -0
- package/docs-site-docusaurus/static/robots.txt +4 -0
- package/docs-site-docusaurus/typedoc.json +23 -0
- package/package.json +106 -10
- package/src/data-structures/base/index.ts +1 -0
- package/src/data-structures/base/iterable-entry-base.ts +8 -8
- package/src/data-structures/base/linear-base.ts +3 -3
- package/src/data-structures/binary-tree/avl-tree.ts +240 -0
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +281 -1
- package/src/data-structures/binary-tree/binary-tree.ts +502 -2
- package/src/data-structures/binary-tree/bst.ts +481 -1
- package/src/data-structures/binary-tree/red-black-tree.ts +380 -0
- package/src/data-structures/binary-tree/segment-tree.ts +121 -2
- package/src/data-structures/binary-tree/tree-map.ts +2862 -482
- package/src/data-structures/binary-tree/tree-multi-map.ts +2963 -563
- package/src/data-structures/binary-tree/tree-multi-set.ts +2399 -479
- package/src/data-structures/binary-tree/tree-set.ts +2685 -405
- package/src/data-structures/graph/abstract-graph.ts +4 -4
- package/src/data-structures/graph/directed-graph.ts +200 -0
- package/src/data-structures/graph/undirected-graph.ts +180 -0
- package/src/data-structures/hash/hash-map.ts +235 -15
- package/src/data-structures/heap/heap.ts +280 -0
- package/src/data-structures/linked-list/doubly-linked-list.ts +343 -3
- package/src/data-structures/linked-list/singly-linked-list.ts +303 -3
- package/src/data-structures/linked-list/skip-linked-list.ts +362 -2
- package/src/data-structures/matrix/matrix.ts +161 -1
- package/src/data-structures/queue/deque.ts +305 -5
- package/src/data-structures/queue/queue.ts +240 -0
- package/src/data-structures/stack/stack.ts +200 -0
- package/src/data-structures/trie/trie.ts +245 -5
- package/src/interfaces/graph.ts +1 -1
- package/src/types/common.ts +2 -2
- package/src/types/data-structures/heap/heap.ts +1 -0
- package/src/types/data-structures/priority-queue/priority-queue.ts +1 -0
- package/src/types/utils/validate-type.ts +4 -4
- package/vercel.json +6 -0
- package/dist/leetcode/avl-tree-counter.mjs +0 -2957
- package/dist/leetcode/avl-tree-multi-map.mjs +0 -2889
- package/dist/leetcode/avl-tree.mjs +0 -2720
- package/dist/leetcode/binary-tree.mjs +0 -1594
- package/dist/leetcode/bst.mjs +0 -2398
- package/dist/leetcode/deque.mjs +0 -683
- package/dist/leetcode/directed-graph.mjs +0 -1733
- package/dist/leetcode/doubly-linked-list.mjs +0 -709
- package/dist/leetcode/hash-map.mjs +0 -493
- package/dist/leetcode/heap.mjs +0 -542
- package/dist/leetcode/max-heap.mjs +0 -375
- package/dist/leetcode/max-priority-queue.mjs +0 -383
- package/dist/leetcode/min-heap.mjs +0 -363
- package/dist/leetcode/min-priority-queue.mjs +0 -371
- package/dist/leetcode/priority-queue.mjs +0 -363
- package/dist/leetcode/queue.mjs +0 -943
- package/dist/leetcode/red-black-tree.mjs +0 -2765
- package/dist/leetcode/singly-linked-list.mjs +0 -754
- package/dist/leetcode/stack.mjs +0 -217
- package/dist/leetcode/tree-counter.mjs +0 -3039
- package/dist/leetcode/tree-multi-map.mjs +0 -2913
- package/dist/leetcode/trie.mjs +0 -413
- package/dist/leetcode/undirected-graph.mjs +0 -1650
|
@@ -89,14 +89,6 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
89
89
|
|
|
90
90
|
|
|
91
91
|
|
|
92
|
-
* @example
|
|
93
|
-
* // Check if empty
|
|
94
|
-
* console.log(new TreeMultiMap().isEmpty()); // true;
|
|
95
|
-
*/
|
|
96
|
-
isEmpty(): boolean;
|
|
97
|
-
/**
|
|
98
|
-
* Removes all entries from the map.
|
|
99
|
-
* @remarks Time O(1), Space O(1)
|
|
100
92
|
|
|
101
93
|
|
|
102
94
|
|
|
@@ -135,44 +127,16 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
135
127
|
|
|
136
128
|
|
|
137
129
|
|
|
138
|
-
* @example
|
|
139
|
-
* // Remove all entries
|
|
140
|
-
* const mm = new TreeMultiMap<number, string>();
|
|
141
|
-
* mm.add(1, 'a');
|
|
142
|
-
* mm.clear();
|
|
143
|
-
* console.log(mm.isEmpty()); // true;
|
|
144
|
-
*/
|
|
145
|
-
clear(): void;
|
|
146
|
-
/**
|
|
147
|
-
* Bucket length for a key (missing => 0).
|
|
148
|
-
* @remarks Time O(log n), Space O(1)
|
|
149
130
|
|
|
150
131
|
|
|
151
|
-
* @example
|
|
152
|
-
* // Count values for key
|
|
153
|
-
* const mm = new TreeMultiMap<number, string>();
|
|
154
|
-
* mm.add(1, 'a');
|
|
155
|
-
* mm.add(1, 'b');
|
|
156
|
-
* console.log(mm.count(1)); // 2;
|
|
157
|
-
*/
|
|
158
|
-
count(key: K): number;
|
|
159
|
-
/**
|
|
160
|
-
* Total number of values across all buckets (Σ bucket.length).
|
|
161
|
-
* @remarks Time O(n), Space O(1)
|
|
162
132
|
|
|
163
133
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
* console.log(mm.totalSize); // 3;
|
|
171
|
-
*/
|
|
172
|
-
get totalSize(): number;
|
|
173
|
-
/**
|
|
174
|
-
* Whether the map contains the given key.
|
|
175
|
-
* @remarks Time O(log n), Space O(1)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
176
140
|
|
|
177
141
|
|
|
178
142
|
|
|
@@ -226,16 +190,99 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
226
190
|
|
|
227
191
|
|
|
228
192
|
* @example
|
|
229
|
-
* // Check
|
|
230
|
-
*
|
|
231
|
-
* mm.add(1, 'a');
|
|
232
|
-
* console.log(mm.has(1)); // true;
|
|
233
|
-
* console.log(mm.has(2)); // false;
|
|
193
|
+
* // Check if empty
|
|
194
|
+
* console.log(new TreeMultiMap().isEmpty()); // true;
|
|
234
195
|
*/
|
|
235
|
-
|
|
196
|
+
isEmpty(): boolean;
|
|
236
197
|
/**
|
|
237
|
-
*
|
|
238
|
-
* @remarks Time O(
|
|
198
|
+
* Removes all entries from the map.
|
|
199
|
+
* @remarks Time O(1), Space O(1)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
239
286
|
|
|
240
287
|
|
|
241
288
|
|
|
@@ -289,15 +336,15 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
289
336
|
|
|
290
337
|
|
|
291
338
|
* @example
|
|
292
|
-
* //
|
|
339
|
+
* // Remove all entries
|
|
293
340
|
* const mm = new TreeMultiMap<number, string>();
|
|
294
341
|
* mm.add(1, 'a');
|
|
295
|
-
* mm.
|
|
296
|
-
* console.log(mm.
|
|
342
|
+
* mm.clear();
|
|
343
|
+
* console.log(mm.isEmpty()); // true;
|
|
297
344
|
*/
|
|
298
|
-
|
|
345
|
+
clear(): void;
|
|
299
346
|
/**
|
|
300
|
-
*
|
|
347
|
+
* Bucket length for a key (missing => 0).
|
|
301
348
|
* @remarks Time O(log n), Space O(1)
|
|
302
349
|
|
|
303
350
|
|
|
@@ -319,6 +366,29 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
319
366
|
|
|
320
367
|
|
|
321
368
|
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
* @example
|
|
372
|
+
* // Count values for key
|
|
373
|
+
* const mm = new TreeMultiMap<number, string>();
|
|
374
|
+
* mm.add(1, 'a');
|
|
375
|
+
* mm.add(1, 'b');
|
|
376
|
+
* console.log(mm.count(1)); // 2;
|
|
377
|
+
*/
|
|
378
|
+
count(key: K): number;
|
|
379
|
+
/**
|
|
380
|
+
* Total number of values across all buckets (Σ bucket.length).
|
|
381
|
+
* @remarks Time O(n), Space O(1)
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
|
|
322
392
|
|
|
323
393
|
|
|
324
394
|
|
|
@@ -332,17 +402,17 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
332
402
|
|
|
333
403
|
|
|
334
404
|
* @example
|
|
335
|
-
* //
|
|
405
|
+
* // Total number of values
|
|
336
406
|
* const mm = new TreeMultiMap<number, string>();
|
|
337
407
|
* mm.add(1, 'a');
|
|
338
408
|
* mm.add(1, 'b');
|
|
339
409
|
* mm.add(2, 'c');
|
|
340
|
-
* console.log(mm.
|
|
410
|
+
* console.log(mm.totalSize); // 3;
|
|
341
411
|
*/
|
|
342
|
-
|
|
412
|
+
get totalSize(): number;
|
|
343
413
|
/**
|
|
344
|
-
*
|
|
345
|
-
* @remarks Time O(log n), Space O(1)
|
|
414
|
+
* Whether the map contains the given key.
|
|
415
|
+
* @remarks Time O(log n), Space O(1)
|
|
346
416
|
|
|
347
417
|
|
|
348
418
|
|
|
@@ -393,18 +463,6 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
393
463
|
|
|
394
464
|
|
|
395
465
|
|
|
396
|
-
* @example
|
|
397
|
-
* // Set values for key
|
|
398
|
-
* const mm = new TreeMultiMap<number, string>();
|
|
399
|
-
* mm.set(1, 'a');
|
|
400
|
-
* mm.set(1, 'b');
|
|
401
|
-
* console.log(mm.get(1)); // ['a', 'b'];
|
|
402
|
-
*/
|
|
403
|
-
set(entry: [K | null | undefined, V[] | undefined] | K | null | undefined, value?: V): boolean;
|
|
404
|
-
set(key: K, value: V): boolean;
|
|
405
|
-
/**
|
|
406
|
-
* Deletes a key and its entire bucket.
|
|
407
|
-
* @remarks Time O(log n), Space O(1)
|
|
408
466
|
|
|
409
467
|
|
|
410
468
|
|
|
@@ -457,65 +515,12 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
457
515
|
|
|
458
516
|
|
|
459
517
|
|
|
460
|
-
* @example
|
|
461
|
-
* // Remove key
|
|
462
|
-
* const mm = new TreeMultiMap<number, string>();
|
|
463
|
-
* mm.add(1, 'a');
|
|
464
|
-
* mm.add(2, 'b');
|
|
465
|
-
* mm.delete(1);
|
|
466
|
-
* console.log(mm.has(1)); // false;
|
|
467
|
-
*/
|
|
468
|
-
delete(key: K): boolean;
|
|
469
|
-
/**
|
|
470
|
-
* Check if a specific value exists in a key's bucket.
|
|
471
|
-
* @remarks Time O(log n + m), Space O(1) where m is bucket size
|
|
472
518
|
|
|
473
519
|
|
|
474
|
-
* @example
|
|
475
|
-
* // Check specific key-value
|
|
476
|
-
* const mm = new TreeMultiMap<number, string>();
|
|
477
|
-
* mm.add(1, 'a');
|
|
478
|
-
* console.log(mm.hasEntry(1, 'a')); // true;
|
|
479
|
-
* console.log(mm.hasEntry(1, 'z')); // false;
|
|
480
|
-
*/
|
|
481
|
-
hasEntry(key: K, value: V, eq?: (a: V, b: V) => boolean): boolean;
|
|
482
|
-
/**
|
|
483
|
-
* Delete a single occurrence of a value from a key's bucket.
|
|
484
|
-
* @remarks Time O(log n + m), Space O(1) where m is bucket size
|
|
485
520
|
|
|
486
521
|
|
|
487
|
-
* @example
|
|
488
|
-
* // Delete specific value
|
|
489
|
-
* const mm = new TreeMultiMap<number, string>();
|
|
490
|
-
* mm.add(1, 'a');
|
|
491
|
-
* mm.add(1, 'b');
|
|
492
|
-
* mm.deleteValue(1, 'a');
|
|
493
|
-
* console.log(mm.get(1)); // ['b'];
|
|
494
|
-
*/
|
|
495
|
-
deleteValue(key: K, value: V, eq?: (a: V, b: V) => boolean): boolean;
|
|
496
|
-
/**
|
|
497
|
-
* Delete all occurrences of a value from a key's bucket.
|
|
498
|
-
* @remarks Time O(log n + m), Space O(1) where m is bucket size
|
|
499
522
|
|
|
500
523
|
|
|
501
|
-
* @example
|
|
502
|
-
* // Delete all matching values
|
|
503
|
-
* const mm = new TreeMultiMap<number, string>();
|
|
504
|
-
* mm.add(1, 'a');
|
|
505
|
-
* mm.add(1, 'a');
|
|
506
|
-
* mm.add(1, 'b');
|
|
507
|
-
* const count = mm.deleteValues(1, 'a');
|
|
508
|
-
* console.log(count); // 2;
|
|
509
|
-
*/
|
|
510
|
-
deleteValues(key: K, value: V, eq?: (a: V, b: V) => boolean): number;
|
|
511
|
-
/**
|
|
512
|
-
* Iterates over all entries as [key, bucket] pairs.
|
|
513
|
-
* @remarks Time O(n), Space O(1)
|
|
514
|
-
*/
|
|
515
|
-
[Symbol.iterator](): Iterator<[K, V[]]>;
|
|
516
|
-
/**
|
|
517
|
-
* Iterates over all keys.
|
|
518
|
-
* @remarks Time O(n), Space O(1)
|
|
519
524
|
|
|
520
525
|
|
|
521
526
|
|
|
@@ -554,16 +559,2588 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
554
559
|
|
|
555
560
|
|
|
556
561
|
|
|
557
|
-
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
* @example
|
|
589
|
+
* // Check key existence
|
|
590
|
+
* const mm = new TreeMultiMap<number, string>();
|
|
591
|
+
* mm.add(1, 'a');
|
|
592
|
+
* console.log(mm.has(1)); // true;
|
|
593
|
+
* console.log(mm.has(2)); // false;
|
|
594
|
+
*/
|
|
595
|
+
has(key: K): boolean;
|
|
596
|
+
/**
|
|
597
|
+
* Live bucket reference (do not auto-delete key if bucket becomes empty via mutation).
|
|
598
|
+
* @remarks Time O(log n), Space O(1)
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
|
|
634
|
+
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+
|
|
644
|
+
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
|
|
654
|
+
|
|
655
|
+
|
|
656
|
+
|
|
657
|
+
|
|
658
|
+
|
|
659
|
+
|
|
660
|
+
|
|
661
|
+
|
|
662
|
+
|
|
663
|
+
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
|
|
672
|
+
|
|
673
|
+
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
|
|
677
|
+
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
|
|
688
|
+
|
|
689
|
+
|
|
690
|
+
|
|
691
|
+
|
|
692
|
+
|
|
693
|
+
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
|
|
707
|
+
|
|
708
|
+
|
|
709
|
+
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
|
|
727
|
+
|
|
728
|
+
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
|
|
733
|
+
|
|
734
|
+
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
|
|
744
|
+
|
|
745
|
+
|
|
746
|
+
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
|
|
761
|
+
|
|
762
|
+
|
|
763
|
+
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
|
|
771
|
+
* @example
|
|
772
|
+
* // Get values for key
|
|
773
|
+
* const mm = new TreeMultiMap<number, string>();
|
|
774
|
+
* mm.add(1, 'a');
|
|
775
|
+
* mm.add(1, 'b');
|
|
776
|
+
* console.log(mm.get(1)); // ['a', 'b'];
|
|
777
|
+
*/
|
|
778
|
+
get(key: K): V[] | undefined;
|
|
779
|
+
/**
|
|
780
|
+
* Append a single value.
|
|
781
|
+
* @remarks Time O(log n), Space O(1)
|
|
782
|
+
|
|
783
|
+
|
|
784
|
+
|
|
785
|
+
|
|
786
|
+
|
|
787
|
+
|
|
788
|
+
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
|
|
795
|
+
|
|
796
|
+
|
|
797
|
+
|
|
798
|
+
|
|
799
|
+
|
|
800
|
+
|
|
801
|
+
|
|
802
|
+
|
|
803
|
+
|
|
804
|
+
|
|
805
|
+
|
|
806
|
+
|
|
807
|
+
|
|
808
|
+
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
|
|
817
|
+
|
|
818
|
+
|
|
819
|
+
|
|
820
|
+
|
|
821
|
+
|
|
822
|
+
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
|
|
828
|
+
|
|
829
|
+
|
|
830
|
+
|
|
831
|
+
|
|
832
|
+
|
|
833
|
+
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
|
|
837
|
+
|
|
838
|
+
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
|
|
843
|
+
|
|
844
|
+
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
|
|
848
|
+
|
|
849
|
+
|
|
850
|
+
|
|
851
|
+
|
|
852
|
+
|
|
853
|
+
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
|
|
857
|
+
|
|
858
|
+
|
|
859
|
+
|
|
860
|
+
|
|
861
|
+
|
|
862
|
+
|
|
863
|
+
|
|
864
|
+
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
|
|
868
|
+
|
|
869
|
+
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
|
|
874
|
+
|
|
875
|
+
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
|
|
880
|
+
|
|
881
|
+
|
|
882
|
+
|
|
883
|
+
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
|
|
888
|
+
|
|
889
|
+
|
|
890
|
+
|
|
891
|
+
|
|
892
|
+
|
|
893
|
+
|
|
894
|
+
|
|
895
|
+
|
|
896
|
+
|
|
897
|
+
|
|
898
|
+
|
|
899
|
+
|
|
900
|
+
|
|
901
|
+
|
|
902
|
+
|
|
903
|
+
|
|
904
|
+
|
|
905
|
+
|
|
906
|
+
|
|
907
|
+
|
|
908
|
+
|
|
909
|
+
|
|
910
|
+
|
|
911
|
+
|
|
912
|
+
|
|
913
|
+
|
|
914
|
+
* @example
|
|
915
|
+
* // Add key-value pair
|
|
916
|
+
* const mm = new TreeMultiMap<number, string>();
|
|
917
|
+
* mm.add(1, 'a');
|
|
918
|
+
* mm.add(1, 'b');
|
|
919
|
+
* mm.add(2, 'c');
|
|
920
|
+
* console.log(mm.get(1)); // ['a', 'b'];
|
|
921
|
+
*/
|
|
922
|
+
add(key: K, value: V): boolean;
|
|
923
|
+
/**
|
|
924
|
+
* Alias for compatibility with existing TreeMultiMap semantics.
|
|
925
|
+
* @remarks Time O(log n), Space O(1) for single value; O(log n + m) for bucket append
|
|
926
|
+
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
|
|
930
|
+
|
|
931
|
+
|
|
932
|
+
|
|
933
|
+
|
|
934
|
+
|
|
935
|
+
|
|
936
|
+
|
|
937
|
+
|
|
938
|
+
|
|
939
|
+
|
|
940
|
+
|
|
941
|
+
|
|
942
|
+
|
|
943
|
+
|
|
944
|
+
|
|
945
|
+
|
|
946
|
+
|
|
947
|
+
|
|
948
|
+
|
|
949
|
+
|
|
950
|
+
|
|
951
|
+
|
|
952
|
+
|
|
953
|
+
|
|
954
|
+
|
|
955
|
+
|
|
956
|
+
|
|
957
|
+
|
|
958
|
+
|
|
959
|
+
|
|
960
|
+
|
|
961
|
+
|
|
962
|
+
|
|
963
|
+
|
|
964
|
+
|
|
965
|
+
|
|
966
|
+
|
|
967
|
+
|
|
968
|
+
|
|
969
|
+
|
|
970
|
+
|
|
971
|
+
|
|
972
|
+
|
|
973
|
+
|
|
974
|
+
|
|
975
|
+
|
|
976
|
+
|
|
977
|
+
|
|
978
|
+
|
|
979
|
+
|
|
980
|
+
|
|
981
|
+
|
|
982
|
+
|
|
983
|
+
|
|
984
|
+
|
|
985
|
+
|
|
986
|
+
|
|
987
|
+
|
|
988
|
+
|
|
989
|
+
|
|
990
|
+
|
|
991
|
+
|
|
992
|
+
|
|
993
|
+
|
|
994
|
+
|
|
995
|
+
|
|
996
|
+
|
|
997
|
+
|
|
998
|
+
|
|
999
|
+
|
|
1000
|
+
|
|
1001
|
+
|
|
1002
|
+
|
|
1003
|
+
|
|
1004
|
+
|
|
1005
|
+
|
|
1006
|
+
|
|
1007
|
+
|
|
1008
|
+
|
|
1009
|
+
|
|
1010
|
+
|
|
1011
|
+
|
|
1012
|
+
|
|
1013
|
+
|
|
1014
|
+
|
|
1015
|
+
|
|
1016
|
+
|
|
1017
|
+
|
|
1018
|
+
|
|
1019
|
+
|
|
1020
|
+
|
|
1021
|
+
|
|
1022
|
+
|
|
1023
|
+
|
|
1024
|
+
|
|
1025
|
+
|
|
1026
|
+
|
|
1027
|
+
|
|
1028
|
+
|
|
1029
|
+
|
|
1030
|
+
|
|
1031
|
+
|
|
1032
|
+
|
|
1033
|
+
|
|
1034
|
+
|
|
1035
|
+
|
|
1036
|
+
|
|
1037
|
+
|
|
1038
|
+
|
|
1039
|
+
|
|
1040
|
+
|
|
1041
|
+
|
|
1042
|
+
|
|
1043
|
+
|
|
1044
|
+
|
|
1045
|
+
|
|
1046
|
+
|
|
1047
|
+
|
|
1048
|
+
|
|
1049
|
+
|
|
1050
|
+
|
|
1051
|
+
|
|
1052
|
+
|
|
1053
|
+
|
|
1054
|
+
|
|
1055
|
+
|
|
1056
|
+
|
|
1057
|
+
|
|
1058
|
+
|
|
1059
|
+
|
|
1060
|
+
|
|
1061
|
+
|
|
1062
|
+
|
|
1063
|
+
|
|
1064
|
+
|
|
1065
|
+
|
|
1066
|
+
|
|
1067
|
+
|
|
1068
|
+
|
|
1069
|
+
|
|
1070
|
+
|
|
1071
|
+
|
|
1072
|
+
|
|
1073
|
+
|
|
1074
|
+
|
|
1075
|
+
|
|
1076
|
+
|
|
1077
|
+
|
|
1078
|
+
|
|
1079
|
+
|
|
1080
|
+
|
|
1081
|
+
|
|
1082
|
+
|
|
1083
|
+
|
|
1084
|
+
|
|
1085
|
+
|
|
1086
|
+
|
|
1087
|
+
|
|
1088
|
+
|
|
1089
|
+
|
|
1090
|
+
|
|
1091
|
+
|
|
1092
|
+
|
|
1093
|
+
|
|
1094
|
+
|
|
1095
|
+
|
|
1096
|
+
* @example
|
|
1097
|
+
* // Set values for key
|
|
1098
|
+
* const mm = new TreeMultiMap<number, string>();
|
|
1099
|
+
* mm.set(1, 'a');
|
|
1100
|
+
* mm.set(1, 'b');
|
|
1101
|
+
* console.log(mm.get(1)); // ['a', 'b'];
|
|
1102
|
+
*/
|
|
1103
|
+
set(entry: [K | null | undefined, V[] | undefined] | K | null | undefined, value?: V): boolean;
|
|
1104
|
+
set(key: K, value: V): boolean;
|
|
1105
|
+
/**
|
|
1106
|
+
* Deletes a key and its entire bucket.
|
|
1107
|
+
* @remarks Time O(log n), Space O(1)
|
|
1108
|
+
|
|
1109
|
+
|
|
1110
|
+
|
|
1111
|
+
|
|
1112
|
+
|
|
1113
|
+
|
|
1114
|
+
|
|
1115
|
+
|
|
1116
|
+
|
|
1117
|
+
|
|
1118
|
+
|
|
1119
|
+
|
|
1120
|
+
|
|
1121
|
+
|
|
1122
|
+
|
|
1123
|
+
|
|
1124
|
+
|
|
1125
|
+
|
|
1126
|
+
|
|
1127
|
+
|
|
1128
|
+
|
|
1129
|
+
|
|
1130
|
+
|
|
1131
|
+
|
|
1132
|
+
|
|
1133
|
+
|
|
1134
|
+
|
|
1135
|
+
|
|
1136
|
+
|
|
1137
|
+
|
|
1138
|
+
|
|
1139
|
+
|
|
1140
|
+
|
|
1141
|
+
|
|
1142
|
+
|
|
1143
|
+
|
|
1144
|
+
|
|
1145
|
+
|
|
1146
|
+
|
|
1147
|
+
|
|
1148
|
+
|
|
1149
|
+
|
|
1150
|
+
|
|
1151
|
+
|
|
1152
|
+
|
|
1153
|
+
|
|
1154
|
+
|
|
1155
|
+
|
|
1156
|
+
|
|
1157
|
+
|
|
1158
|
+
|
|
1159
|
+
|
|
1160
|
+
|
|
1161
|
+
|
|
1162
|
+
|
|
1163
|
+
|
|
1164
|
+
|
|
1165
|
+
|
|
1166
|
+
|
|
1167
|
+
|
|
1168
|
+
|
|
1169
|
+
|
|
1170
|
+
|
|
1171
|
+
|
|
1172
|
+
|
|
1173
|
+
|
|
1174
|
+
|
|
1175
|
+
|
|
1176
|
+
|
|
1177
|
+
|
|
1178
|
+
|
|
1179
|
+
|
|
1180
|
+
|
|
1181
|
+
|
|
1182
|
+
|
|
1183
|
+
|
|
1184
|
+
|
|
1185
|
+
|
|
1186
|
+
|
|
1187
|
+
|
|
1188
|
+
|
|
1189
|
+
|
|
1190
|
+
|
|
1191
|
+
|
|
1192
|
+
|
|
1193
|
+
|
|
1194
|
+
|
|
1195
|
+
|
|
1196
|
+
|
|
1197
|
+
|
|
1198
|
+
|
|
1199
|
+
|
|
1200
|
+
|
|
1201
|
+
|
|
1202
|
+
|
|
1203
|
+
|
|
1204
|
+
|
|
1205
|
+
|
|
1206
|
+
|
|
1207
|
+
|
|
1208
|
+
|
|
1209
|
+
|
|
1210
|
+
|
|
1211
|
+
|
|
1212
|
+
|
|
1213
|
+
|
|
1214
|
+
|
|
1215
|
+
|
|
1216
|
+
|
|
1217
|
+
|
|
1218
|
+
|
|
1219
|
+
|
|
1220
|
+
|
|
1221
|
+
|
|
1222
|
+
|
|
1223
|
+
|
|
1224
|
+
|
|
1225
|
+
|
|
1226
|
+
|
|
1227
|
+
|
|
1228
|
+
|
|
1229
|
+
|
|
1230
|
+
|
|
1231
|
+
|
|
1232
|
+
|
|
1233
|
+
|
|
1234
|
+
|
|
1235
|
+
|
|
1236
|
+
|
|
1237
|
+
|
|
1238
|
+
|
|
1239
|
+
|
|
1240
|
+
|
|
1241
|
+
|
|
1242
|
+
|
|
1243
|
+
|
|
1244
|
+
|
|
1245
|
+
|
|
1246
|
+
|
|
1247
|
+
|
|
1248
|
+
|
|
1249
|
+
|
|
1250
|
+
|
|
1251
|
+
|
|
1252
|
+
|
|
1253
|
+
|
|
1254
|
+
|
|
1255
|
+
|
|
1256
|
+
|
|
1257
|
+
|
|
1258
|
+
|
|
1259
|
+
|
|
1260
|
+
|
|
1261
|
+
|
|
1262
|
+
|
|
1263
|
+
|
|
1264
|
+
|
|
1265
|
+
|
|
1266
|
+
|
|
1267
|
+
|
|
1268
|
+
|
|
1269
|
+
|
|
1270
|
+
|
|
1271
|
+
|
|
1272
|
+
|
|
1273
|
+
|
|
1274
|
+
|
|
1275
|
+
|
|
1276
|
+
|
|
1277
|
+
|
|
1278
|
+
|
|
1279
|
+
|
|
1280
|
+
* @example
|
|
1281
|
+
* // Remove key
|
|
1282
|
+
* const mm = new TreeMultiMap<number, string>();
|
|
1283
|
+
* mm.add(1, 'a');
|
|
1284
|
+
* mm.add(2, 'b');
|
|
1285
|
+
* mm.delete(1);
|
|
1286
|
+
* console.log(mm.has(1)); // false;
|
|
1287
|
+
*/
|
|
1288
|
+
delete(key: K): boolean;
|
|
1289
|
+
/**
|
|
1290
|
+
* Check if a specific value exists in a key's bucket.
|
|
1291
|
+
* @remarks Time O(log n + m), Space O(1) where m is bucket size
|
|
1292
|
+
|
|
1293
|
+
|
|
1294
|
+
|
|
1295
|
+
|
|
1296
|
+
|
|
1297
|
+
|
|
1298
|
+
|
|
1299
|
+
|
|
1300
|
+
|
|
1301
|
+
|
|
1302
|
+
|
|
1303
|
+
|
|
1304
|
+
|
|
1305
|
+
|
|
1306
|
+
|
|
1307
|
+
|
|
1308
|
+
|
|
1309
|
+
|
|
1310
|
+
|
|
1311
|
+
|
|
1312
|
+
|
|
1313
|
+
|
|
1314
|
+
* @example
|
|
1315
|
+
* // Check specific key-value
|
|
1316
|
+
* const mm = new TreeMultiMap<number, string>();
|
|
1317
|
+
* mm.add(1, 'a');
|
|
1318
|
+
* console.log(mm.hasEntry(1, 'a')); // true;
|
|
1319
|
+
* console.log(mm.hasEntry(1, 'z')); // false;
|
|
1320
|
+
*/
|
|
1321
|
+
hasEntry(key: K, value: V, eq?: (a: V, b: V) => boolean): boolean;
|
|
1322
|
+
/**
|
|
1323
|
+
* Delete a single occurrence of a value from a key's bucket.
|
|
1324
|
+
* @remarks Time O(log n + m), Space O(1) where m is bucket size
|
|
1325
|
+
|
|
1326
|
+
|
|
1327
|
+
|
|
1328
|
+
|
|
1329
|
+
|
|
1330
|
+
|
|
1331
|
+
|
|
1332
|
+
|
|
1333
|
+
|
|
1334
|
+
|
|
1335
|
+
|
|
1336
|
+
|
|
1337
|
+
|
|
1338
|
+
|
|
1339
|
+
|
|
1340
|
+
|
|
1341
|
+
|
|
1342
|
+
|
|
1343
|
+
|
|
1344
|
+
|
|
1345
|
+
|
|
1346
|
+
|
|
1347
|
+
* @example
|
|
1348
|
+
* // Delete specific value
|
|
1349
|
+
* const mm = new TreeMultiMap<number, string>();
|
|
1350
|
+
* mm.add(1, 'a');
|
|
1351
|
+
* mm.add(1, 'b');
|
|
1352
|
+
* mm.deleteValue(1, 'a');
|
|
1353
|
+
* console.log(mm.get(1)); // ['b'];
|
|
1354
|
+
*/
|
|
1355
|
+
deleteValue(key: K, value: V, eq?: (a: V, b: V) => boolean): boolean;
|
|
1356
|
+
/**
|
|
1357
|
+
* Delete all occurrences of a value from a key's bucket.
|
|
1358
|
+
* @remarks Time O(log n + m), Space O(1) where m is bucket size
|
|
1359
|
+
|
|
1360
|
+
|
|
1361
|
+
|
|
1362
|
+
|
|
1363
|
+
|
|
1364
|
+
|
|
1365
|
+
|
|
1366
|
+
|
|
1367
|
+
|
|
1368
|
+
|
|
1369
|
+
|
|
1370
|
+
|
|
1371
|
+
|
|
1372
|
+
|
|
1373
|
+
|
|
1374
|
+
|
|
1375
|
+
|
|
1376
|
+
|
|
1377
|
+
|
|
1378
|
+
|
|
1379
|
+
|
|
1380
|
+
|
|
1381
|
+
* @example
|
|
1382
|
+
* // Delete all matching values
|
|
1383
|
+
* const mm = new TreeMultiMap<number, string>();
|
|
1384
|
+
* mm.add(1, 'a');
|
|
1385
|
+
* mm.add(1, 'a');
|
|
1386
|
+
* mm.add(1, 'b');
|
|
1387
|
+
* const count = mm.deleteValues(1, 'a');
|
|
1388
|
+
* console.log(count); // 2;
|
|
1389
|
+
*/
|
|
1390
|
+
deleteValues(key: K, value: V, eq?: (a: V, b: V) => boolean): number;
|
|
1391
|
+
/**
|
|
1392
|
+
* Iterates over all entries as [key, bucket] pairs.
|
|
1393
|
+
* @remarks Time O(n), Space O(1)
|
|
1394
|
+
*/
|
|
1395
|
+
[Symbol.iterator](): Iterator<[K, V[]]>;
|
|
1396
|
+
/**
|
|
1397
|
+
* Iterates over all keys.
|
|
1398
|
+
* @remarks Time O(n), Space O(1)
|
|
1399
|
+
|
|
1400
|
+
|
|
1401
|
+
|
|
1402
|
+
|
|
1403
|
+
|
|
1404
|
+
|
|
1405
|
+
|
|
1406
|
+
|
|
1407
|
+
|
|
1408
|
+
|
|
1409
|
+
|
|
1410
|
+
|
|
1411
|
+
|
|
1412
|
+
|
|
1413
|
+
|
|
1414
|
+
|
|
1415
|
+
|
|
1416
|
+
|
|
1417
|
+
|
|
1418
|
+
|
|
1419
|
+
|
|
1420
|
+
|
|
1421
|
+
|
|
1422
|
+
|
|
1423
|
+
|
|
1424
|
+
|
|
1425
|
+
|
|
1426
|
+
|
|
1427
|
+
|
|
1428
|
+
|
|
1429
|
+
|
|
1430
|
+
|
|
1431
|
+
|
|
1432
|
+
|
|
1433
|
+
|
|
1434
|
+
|
|
1435
|
+
|
|
1436
|
+
|
|
1437
|
+
|
|
1438
|
+
|
|
1439
|
+
|
|
1440
|
+
|
|
1441
|
+
|
|
1442
|
+
|
|
1443
|
+
|
|
1444
|
+
|
|
1445
|
+
|
|
1446
|
+
|
|
1447
|
+
|
|
1448
|
+
|
|
1449
|
+
|
|
1450
|
+
|
|
1451
|
+
|
|
1452
|
+
|
|
1453
|
+
|
|
1454
|
+
|
|
1455
|
+
|
|
1456
|
+
|
|
1457
|
+
|
|
1458
|
+
|
|
1459
|
+
|
|
1460
|
+
|
|
1461
|
+
|
|
1462
|
+
|
|
1463
|
+
|
|
1464
|
+
|
|
1465
|
+
|
|
1466
|
+
|
|
1467
|
+
|
|
1468
|
+
|
|
1469
|
+
|
|
1470
|
+
|
|
1471
|
+
|
|
1472
|
+
|
|
1473
|
+
|
|
1474
|
+
|
|
1475
|
+
|
|
1476
|
+
|
|
1477
|
+
|
|
1478
|
+
|
|
1479
|
+
|
|
1480
|
+
|
|
1481
|
+
|
|
1482
|
+
|
|
1483
|
+
|
|
1484
|
+
|
|
1485
|
+
|
|
1486
|
+
|
|
1487
|
+
|
|
1488
|
+
|
|
1489
|
+
|
|
1490
|
+
|
|
1491
|
+
|
|
1492
|
+
|
|
1493
|
+
|
|
1494
|
+
|
|
1495
|
+
|
|
1496
|
+
|
|
1497
|
+
|
|
1498
|
+
|
|
1499
|
+
|
|
1500
|
+
|
|
1501
|
+
|
|
1502
|
+
|
|
1503
|
+
|
|
1504
|
+
|
|
1505
|
+
|
|
1506
|
+
|
|
1507
|
+
|
|
1508
|
+
|
|
1509
|
+
|
|
1510
|
+
|
|
1511
|
+
|
|
1512
|
+
|
|
1513
|
+
|
|
1514
|
+
|
|
1515
|
+
|
|
1516
|
+
|
|
1517
|
+
|
|
1518
|
+
|
|
1519
|
+
|
|
1520
|
+
|
|
1521
|
+
|
|
1522
|
+
|
|
1523
|
+
|
|
1524
|
+
|
|
1525
|
+
|
|
1526
|
+
|
|
1527
|
+
|
|
1528
|
+
|
|
1529
|
+
|
|
1530
|
+
|
|
1531
|
+
|
|
1532
|
+
|
|
1533
|
+
|
|
1534
|
+
|
|
1535
|
+
|
|
1536
|
+
|
|
1537
|
+
* @example
|
|
558
1538
|
* // Iterate keys
|
|
559
1539
|
* const mm = new TreeMultiMap<number, string>();
|
|
560
1540
|
* mm.add(3, 'c');
|
|
561
1541
|
* mm.add(1, 'a');
|
|
562
|
-
* console.log([...mm.keys()]); // [1, 3];
|
|
1542
|
+
* console.log([...mm.keys()]); // [1, 3];
|
|
1543
|
+
*/
|
|
1544
|
+
keys(): IterableIterator<K>;
|
|
1545
|
+
/**
|
|
1546
|
+
* Iterates over all buckets.
|
|
1547
|
+
* @remarks Time O(n), Space O(1)
|
|
1548
|
+
|
|
1549
|
+
|
|
1550
|
+
|
|
1551
|
+
|
|
1552
|
+
|
|
1553
|
+
|
|
1554
|
+
|
|
1555
|
+
|
|
1556
|
+
|
|
1557
|
+
|
|
1558
|
+
|
|
1559
|
+
|
|
1560
|
+
|
|
1561
|
+
|
|
1562
|
+
|
|
1563
|
+
|
|
1564
|
+
|
|
1565
|
+
|
|
1566
|
+
|
|
1567
|
+
|
|
1568
|
+
|
|
1569
|
+
|
|
1570
|
+
|
|
1571
|
+
|
|
1572
|
+
|
|
1573
|
+
|
|
1574
|
+
|
|
1575
|
+
|
|
1576
|
+
|
|
1577
|
+
|
|
1578
|
+
|
|
1579
|
+
|
|
1580
|
+
|
|
1581
|
+
|
|
1582
|
+
|
|
1583
|
+
|
|
1584
|
+
|
|
1585
|
+
|
|
1586
|
+
|
|
1587
|
+
|
|
1588
|
+
|
|
1589
|
+
|
|
1590
|
+
|
|
1591
|
+
|
|
1592
|
+
|
|
1593
|
+
|
|
1594
|
+
|
|
1595
|
+
|
|
1596
|
+
|
|
1597
|
+
|
|
1598
|
+
|
|
1599
|
+
|
|
1600
|
+
|
|
1601
|
+
|
|
1602
|
+
|
|
1603
|
+
|
|
1604
|
+
|
|
1605
|
+
|
|
1606
|
+
|
|
1607
|
+
|
|
1608
|
+
|
|
1609
|
+
|
|
1610
|
+
|
|
1611
|
+
|
|
1612
|
+
|
|
1613
|
+
|
|
1614
|
+
|
|
1615
|
+
|
|
1616
|
+
|
|
1617
|
+
|
|
1618
|
+
|
|
1619
|
+
|
|
1620
|
+
|
|
1621
|
+
|
|
1622
|
+
|
|
1623
|
+
|
|
1624
|
+
|
|
1625
|
+
|
|
1626
|
+
|
|
1627
|
+
|
|
1628
|
+
|
|
1629
|
+
|
|
1630
|
+
|
|
1631
|
+
|
|
1632
|
+
|
|
1633
|
+
|
|
1634
|
+
|
|
1635
|
+
|
|
1636
|
+
|
|
1637
|
+
|
|
1638
|
+
|
|
1639
|
+
|
|
1640
|
+
|
|
1641
|
+
|
|
1642
|
+
|
|
1643
|
+
|
|
1644
|
+
|
|
1645
|
+
|
|
1646
|
+
|
|
1647
|
+
|
|
1648
|
+
|
|
1649
|
+
|
|
1650
|
+
|
|
1651
|
+
|
|
1652
|
+
|
|
1653
|
+
|
|
1654
|
+
|
|
1655
|
+
|
|
1656
|
+
|
|
1657
|
+
|
|
1658
|
+
|
|
1659
|
+
|
|
1660
|
+
|
|
1661
|
+
|
|
1662
|
+
|
|
1663
|
+
|
|
1664
|
+
|
|
1665
|
+
|
|
1666
|
+
|
|
1667
|
+
|
|
1668
|
+
|
|
1669
|
+
|
|
1670
|
+
|
|
1671
|
+
|
|
1672
|
+
|
|
1673
|
+
|
|
1674
|
+
|
|
1675
|
+
|
|
1676
|
+
|
|
1677
|
+
|
|
1678
|
+
|
|
1679
|
+
|
|
1680
|
+
|
|
1681
|
+
|
|
1682
|
+
|
|
1683
|
+
|
|
1684
|
+
|
|
1685
|
+
|
|
1686
|
+
* @example
|
|
1687
|
+
* // Iterate value arrays
|
|
1688
|
+
* const mm = new TreeMultiMap<number, string>();
|
|
1689
|
+
* mm.add(1, 'a');
|
|
1690
|
+
* mm.add(1, 'b');
|
|
1691
|
+
* console.log([...mm.values()]); // [['a', 'b']];
|
|
1692
|
+
*/
|
|
1693
|
+
values(): IterableIterator<V[]>;
|
|
1694
|
+
/**
|
|
1695
|
+
* Iterates over all entries for a specific key.
|
|
1696
|
+
* @remarks Time O(log n + m), Space O(1) where m is bucket size
|
|
1697
|
+
|
|
1698
|
+
|
|
1699
|
+
|
|
1700
|
+
|
|
1701
|
+
|
|
1702
|
+
|
|
1703
|
+
|
|
1704
|
+
|
|
1705
|
+
|
|
1706
|
+
|
|
1707
|
+
|
|
1708
|
+
|
|
1709
|
+
|
|
1710
|
+
|
|
1711
|
+
|
|
1712
|
+
|
|
1713
|
+
|
|
1714
|
+
|
|
1715
|
+
|
|
1716
|
+
|
|
1717
|
+
|
|
1718
|
+
|
|
1719
|
+
* @example
|
|
1720
|
+
* // Get entries for key
|
|
1721
|
+
* const mm = new TreeMultiMap<number, string>();
|
|
1722
|
+
* mm.add(1, 'a');
|
|
1723
|
+
* mm.add(1, 'b');
|
|
1724
|
+
* console.log([...mm.entriesOf(1)]); // [[1, 'a'], [1, 'b']];
|
|
1725
|
+
*/
|
|
1726
|
+
entriesOf(key: K): IterableIterator<[K, V]>;
|
|
1727
|
+
/**
|
|
1728
|
+
* Iterates over all values for a specific key.
|
|
1729
|
+
* @remarks Time O(log n + m), Space O(1) where m is bucket size
|
|
1730
|
+
|
|
1731
|
+
|
|
1732
|
+
|
|
1733
|
+
|
|
1734
|
+
|
|
1735
|
+
|
|
1736
|
+
|
|
1737
|
+
|
|
1738
|
+
|
|
1739
|
+
|
|
1740
|
+
|
|
1741
|
+
|
|
1742
|
+
|
|
1743
|
+
|
|
1744
|
+
|
|
1745
|
+
|
|
1746
|
+
|
|
1747
|
+
|
|
1748
|
+
|
|
1749
|
+
|
|
1750
|
+
|
|
1751
|
+
|
|
1752
|
+
* @example
|
|
1753
|
+
* // Get flat values for key
|
|
1754
|
+
* const mm = new TreeMultiMap<number, string>();
|
|
1755
|
+
* mm.add(1, 'a');
|
|
1756
|
+
* mm.add(1, 'b');
|
|
1757
|
+
* console.log([...mm.valuesOf(1)]); // ['a', 'b'];
|
|
1758
|
+
*/
|
|
1759
|
+
valuesOf(key: K): IterableIterator<V>;
|
|
1760
|
+
/**
|
|
1761
|
+
* Iterates over all [key, value] pairs (flattened from buckets).
|
|
1762
|
+
* @remarks Time O(T), Space O(1) where T is totalSize
|
|
1763
|
+
|
|
1764
|
+
|
|
1765
|
+
|
|
1766
|
+
|
|
1767
|
+
|
|
1768
|
+
|
|
1769
|
+
|
|
1770
|
+
|
|
1771
|
+
|
|
1772
|
+
|
|
1773
|
+
|
|
1774
|
+
|
|
1775
|
+
|
|
1776
|
+
|
|
1777
|
+
|
|
1778
|
+
|
|
1779
|
+
|
|
1780
|
+
|
|
1781
|
+
|
|
1782
|
+
|
|
1783
|
+
|
|
1784
|
+
|
|
1785
|
+
* @example
|
|
1786
|
+
* // All key-value pairs flattened
|
|
1787
|
+
* const mm = new TreeMultiMap<number, string>();
|
|
1788
|
+
* mm.add(1, 'a');
|
|
1789
|
+
* mm.add(1, 'b');
|
|
1790
|
+
* mm.add(2, 'c');
|
|
1791
|
+
* console.log([...mm.flatEntries()]); // [[1, 'a'], [1, 'b'], [2, 'c']];
|
|
1792
|
+
*/
|
|
1793
|
+
flatEntries(): IterableIterator<[K, V]>;
|
|
1794
|
+
/**
|
|
1795
|
+
* Returns the entry with the smallest key.
|
|
1796
|
+
* @remarks Time O(log n), Space O(1)
|
|
1797
|
+
|
|
1798
|
+
|
|
1799
|
+
|
|
1800
|
+
|
|
1801
|
+
|
|
1802
|
+
|
|
1803
|
+
|
|
1804
|
+
|
|
1805
|
+
|
|
1806
|
+
|
|
1807
|
+
|
|
1808
|
+
|
|
1809
|
+
|
|
1810
|
+
|
|
1811
|
+
|
|
1812
|
+
|
|
1813
|
+
|
|
1814
|
+
|
|
1815
|
+
|
|
1816
|
+
|
|
1817
|
+
|
|
1818
|
+
|
|
1819
|
+
|
|
1820
|
+
|
|
1821
|
+
|
|
1822
|
+
|
|
1823
|
+
|
|
1824
|
+
|
|
1825
|
+
|
|
1826
|
+
|
|
1827
|
+
|
|
1828
|
+
|
|
1829
|
+
|
|
1830
|
+
|
|
1831
|
+
|
|
1832
|
+
|
|
1833
|
+
|
|
1834
|
+
|
|
1835
|
+
|
|
1836
|
+
|
|
1837
|
+
|
|
1838
|
+
|
|
1839
|
+
|
|
1840
|
+
|
|
1841
|
+
|
|
1842
|
+
|
|
1843
|
+
|
|
1844
|
+
|
|
1845
|
+
|
|
1846
|
+
|
|
1847
|
+
|
|
1848
|
+
|
|
1849
|
+
|
|
1850
|
+
|
|
1851
|
+
* @example
|
|
1852
|
+
* // First entry
|
|
1853
|
+
* const mm = new TreeMultiMap<number, string>();
|
|
1854
|
+
* mm.add(3, 'c');
|
|
1855
|
+
* mm.add(1, 'a');
|
|
1856
|
+
* console.log(mm.first()?.[0]); // 1;
|
|
1857
|
+
*/
|
|
1858
|
+
first(): [K, V[]] | undefined;
|
|
1859
|
+
/**
|
|
1860
|
+
* Returns the entry with the largest key.
|
|
1861
|
+
* @remarks Time O(log n), Space O(1)
|
|
1862
|
+
|
|
1863
|
+
|
|
1864
|
+
|
|
1865
|
+
|
|
1866
|
+
|
|
1867
|
+
|
|
1868
|
+
|
|
1869
|
+
|
|
1870
|
+
|
|
1871
|
+
|
|
1872
|
+
|
|
1873
|
+
|
|
1874
|
+
|
|
1875
|
+
|
|
1876
|
+
|
|
1877
|
+
|
|
1878
|
+
|
|
1879
|
+
|
|
1880
|
+
|
|
1881
|
+
|
|
1882
|
+
|
|
1883
|
+
|
|
1884
|
+
|
|
1885
|
+
|
|
1886
|
+
|
|
1887
|
+
|
|
1888
|
+
|
|
1889
|
+
|
|
1890
|
+
|
|
1891
|
+
|
|
1892
|
+
|
|
1893
|
+
|
|
1894
|
+
|
|
1895
|
+
|
|
1896
|
+
|
|
1897
|
+
|
|
1898
|
+
|
|
1899
|
+
|
|
1900
|
+
|
|
1901
|
+
|
|
1902
|
+
|
|
1903
|
+
|
|
1904
|
+
|
|
1905
|
+
|
|
1906
|
+
|
|
1907
|
+
|
|
1908
|
+
|
|
1909
|
+
|
|
1910
|
+
|
|
1911
|
+
|
|
1912
|
+
|
|
1913
|
+
|
|
1914
|
+
|
|
1915
|
+
|
|
1916
|
+
* @example
|
|
1917
|
+
* // Last entry
|
|
1918
|
+
* const mm = new TreeMultiMap<number, string>();
|
|
1919
|
+
* mm.add(1, 'a');
|
|
1920
|
+
* mm.add(3, 'c');
|
|
1921
|
+
* console.log(mm.last()?.[0]); // 3;
|
|
1922
|
+
*/
|
|
1923
|
+
last(): [K, V[]] | undefined;
|
|
1924
|
+
/**
|
|
1925
|
+
* Removes and returns the entry with the smallest key.
|
|
1926
|
+
* @remarks Time O(log n), Space O(1)
|
|
1927
|
+
|
|
1928
|
+
|
|
1929
|
+
|
|
1930
|
+
|
|
1931
|
+
|
|
1932
|
+
|
|
1933
|
+
|
|
1934
|
+
|
|
1935
|
+
|
|
1936
|
+
|
|
1937
|
+
|
|
1938
|
+
|
|
1939
|
+
|
|
1940
|
+
|
|
1941
|
+
|
|
1942
|
+
|
|
1943
|
+
|
|
1944
|
+
|
|
1945
|
+
|
|
1946
|
+
|
|
1947
|
+
|
|
1948
|
+
|
|
1949
|
+
|
|
1950
|
+
* @example
|
|
1951
|
+
* // Remove and return first
|
|
1952
|
+
* const mm = new TreeMultiMap<number, string>();
|
|
1953
|
+
* mm.add(2, 'b');
|
|
1954
|
+
* mm.add(1, 'a');
|
|
1955
|
+
* const first = mm.pollFirst();
|
|
1956
|
+
* console.log(first?.[0]); // 1;
|
|
1957
|
+
* console.log(mm.has(1)); // false;
|
|
1958
|
+
*/
|
|
1959
|
+
pollFirst(): [K, V[]] | undefined;
|
|
1960
|
+
/**
|
|
1961
|
+
* Removes and returns the entry with the largest key.
|
|
1962
|
+
* @remarks Time O(log n), Space O(1)
|
|
1963
|
+
|
|
1964
|
+
|
|
1965
|
+
|
|
1966
|
+
|
|
1967
|
+
|
|
1968
|
+
|
|
1969
|
+
|
|
1970
|
+
|
|
1971
|
+
|
|
1972
|
+
|
|
1973
|
+
|
|
1974
|
+
|
|
1975
|
+
|
|
1976
|
+
|
|
1977
|
+
|
|
1978
|
+
|
|
1979
|
+
|
|
1980
|
+
|
|
1981
|
+
|
|
1982
|
+
|
|
1983
|
+
|
|
1984
|
+
|
|
1985
|
+
|
|
1986
|
+
* @example
|
|
1987
|
+
* // Remove and return last
|
|
1988
|
+
* const mm = new TreeMultiMap<number, string>();
|
|
1989
|
+
* mm.add(1, 'a');
|
|
1990
|
+
* mm.add(3, 'c');
|
|
1991
|
+
* const last = mm.pollLast();
|
|
1992
|
+
* console.log(last?.[0]); // 3;
|
|
1993
|
+
*/
|
|
1994
|
+
pollLast(): [K, V[]] | undefined;
|
|
1995
|
+
/**
|
|
1996
|
+
* Returns the entry with the smallest key >= given key.
|
|
1997
|
+
* @remarks Time O(log n), Space O(1)
|
|
1998
|
+
|
|
1999
|
+
|
|
2000
|
+
|
|
2001
|
+
|
|
2002
|
+
|
|
2003
|
+
|
|
2004
|
+
|
|
2005
|
+
|
|
2006
|
+
|
|
2007
|
+
|
|
2008
|
+
|
|
2009
|
+
|
|
2010
|
+
|
|
2011
|
+
|
|
2012
|
+
|
|
2013
|
+
|
|
2014
|
+
|
|
2015
|
+
|
|
2016
|
+
|
|
2017
|
+
|
|
2018
|
+
|
|
2019
|
+
|
|
2020
|
+
|
|
2021
|
+
|
|
2022
|
+
|
|
2023
|
+
|
|
2024
|
+
|
|
2025
|
+
|
|
2026
|
+
|
|
2027
|
+
|
|
2028
|
+
|
|
2029
|
+
|
|
2030
|
+
|
|
2031
|
+
|
|
2032
|
+
|
|
2033
|
+
|
|
2034
|
+
|
|
2035
|
+
|
|
2036
|
+
|
|
2037
|
+
|
|
2038
|
+
|
|
2039
|
+
|
|
2040
|
+
|
|
2041
|
+
|
|
2042
|
+
|
|
2043
|
+
|
|
2044
|
+
|
|
2045
|
+
|
|
2046
|
+
|
|
2047
|
+
|
|
2048
|
+
|
|
2049
|
+
|
|
2050
|
+
|
|
2051
|
+
|
|
2052
|
+
|
|
2053
|
+
|
|
2054
|
+
|
|
2055
|
+
|
|
2056
|
+
|
|
2057
|
+
|
|
2058
|
+
|
|
2059
|
+
|
|
2060
|
+
|
|
2061
|
+
|
|
2062
|
+
|
|
2063
|
+
|
|
2064
|
+
|
|
2065
|
+
|
|
2066
|
+
|
|
2067
|
+
|
|
2068
|
+
|
|
2069
|
+
|
|
2070
|
+
|
|
2071
|
+
|
|
2072
|
+
|
|
2073
|
+
|
|
2074
|
+
|
|
2075
|
+
|
|
2076
|
+
|
|
2077
|
+
|
|
2078
|
+
|
|
2079
|
+
|
|
2080
|
+
|
|
2081
|
+
|
|
2082
|
+
|
|
2083
|
+
|
|
2084
|
+
|
|
2085
|
+
|
|
2086
|
+
|
|
2087
|
+
|
|
2088
|
+
|
|
2089
|
+
|
|
2090
|
+
|
|
2091
|
+
|
|
2092
|
+
|
|
2093
|
+
|
|
2094
|
+
|
|
2095
|
+
|
|
2096
|
+
|
|
2097
|
+
|
|
2098
|
+
|
|
2099
|
+
|
|
2100
|
+
|
|
2101
|
+
|
|
2102
|
+
|
|
2103
|
+
|
|
2104
|
+
|
|
2105
|
+
|
|
2106
|
+
|
|
2107
|
+
|
|
2108
|
+
|
|
2109
|
+
|
|
2110
|
+
|
|
2111
|
+
|
|
2112
|
+
|
|
2113
|
+
|
|
2114
|
+
|
|
2115
|
+
|
|
2116
|
+
|
|
2117
|
+
|
|
2118
|
+
|
|
2119
|
+
|
|
2120
|
+
|
|
2121
|
+
|
|
2122
|
+
|
|
2123
|
+
|
|
2124
|
+
|
|
2125
|
+
|
|
2126
|
+
|
|
2127
|
+
|
|
2128
|
+
|
|
2129
|
+
|
|
2130
|
+
|
|
2131
|
+
|
|
2132
|
+
|
|
2133
|
+
|
|
2134
|
+
|
|
2135
|
+
|
|
2136
|
+
|
|
2137
|
+
|
|
2138
|
+
|
|
2139
|
+
* @example
|
|
2140
|
+
* // Least key ≥ target
|
|
2141
|
+
* const mm = new TreeMultiMap<number, string>();
|
|
2142
|
+
* mm.add(10, 'a');
|
|
2143
|
+
* mm.add(20, 'b');
|
|
2144
|
+
* mm.add(30, 'c');
|
|
2145
|
+
* console.log(mm.ceiling(15)?.[0]); // 20;
|
|
2146
|
+
*/
|
|
2147
|
+
ceiling(key: K): [K, V[]] | undefined;
|
|
2148
|
+
/**
|
|
2149
|
+
* Returns the entry with the largest key <= given key.
|
|
2150
|
+
* @remarks Time O(log n), Space O(1)
|
|
2151
|
+
|
|
2152
|
+
|
|
2153
|
+
|
|
2154
|
+
|
|
2155
|
+
|
|
2156
|
+
|
|
2157
|
+
|
|
2158
|
+
|
|
2159
|
+
|
|
2160
|
+
|
|
2161
|
+
|
|
2162
|
+
|
|
2163
|
+
|
|
2164
|
+
|
|
2165
|
+
|
|
2166
|
+
|
|
2167
|
+
|
|
2168
|
+
|
|
2169
|
+
|
|
2170
|
+
|
|
2171
|
+
|
|
2172
|
+
|
|
2173
|
+
|
|
2174
|
+
|
|
2175
|
+
|
|
2176
|
+
|
|
2177
|
+
|
|
2178
|
+
|
|
2179
|
+
|
|
2180
|
+
|
|
2181
|
+
|
|
2182
|
+
|
|
2183
|
+
|
|
2184
|
+
|
|
2185
|
+
|
|
2186
|
+
|
|
2187
|
+
|
|
2188
|
+
|
|
2189
|
+
|
|
2190
|
+
|
|
2191
|
+
|
|
2192
|
+
|
|
2193
|
+
|
|
2194
|
+
|
|
2195
|
+
|
|
2196
|
+
|
|
2197
|
+
|
|
2198
|
+
|
|
2199
|
+
|
|
2200
|
+
|
|
2201
|
+
|
|
2202
|
+
|
|
2203
|
+
|
|
2204
|
+
|
|
2205
|
+
|
|
2206
|
+
|
|
2207
|
+
|
|
2208
|
+
|
|
2209
|
+
|
|
2210
|
+
|
|
2211
|
+
|
|
2212
|
+
|
|
2213
|
+
|
|
2214
|
+
|
|
2215
|
+
|
|
2216
|
+
|
|
2217
|
+
|
|
2218
|
+
|
|
2219
|
+
|
|
2220
|
+
|
|
2221
|
+
|
|
2222
|
+
|
|
2223
|
+
|
|
2224
|
+
|
|
2225
|
+
|
|
2226
|
+
|
|
2227
|
+
|
|
2228
|
+
|
|
2229
|
+
|
|
2230
|
+
|
|
2231
|
+
|
|
2232
|
+
|
|
2233
|
+
|
|
2234
|
+
|
|
2235
|
+
|
|
2236
|
+
|
|
2237
|
+
|
|
2238
|
+
|
|
2239
|
+
|
|
2240
|
+
|
|
2241
|
+
|
|
2242
|
+
|
|
2243
|
+
|
|
2244
|
+
|
|
2245
|
+
|
|
2246
|
+
|
|
2247
|
+
|
|
2248
|
+
|
|
2249
|
+
|
|
2250
|
+
|
|
2251
|
+
|
|
2252
|
+
|
|
2253
|
+
|
|
2254
|
+
|
|
2255
|
+
|
|
2256
|
+
|
|
2257
|
+
|
|
2258
|
+
|
|
2259
|
+
|
|
2260
|
+
|
|
2261
|
+
|
|
2262
|
+
|
|
2263
|
+
|
|
2264
|
+
|
|
2265
|
+
|
|
2266
|
+
|
|
2267
|
+
|
|
2268
|
+
|
|
2269
|
+
|
|
2270
|
+
|
|
2271
|
+
|
|
2272
|
+
|
|
2273
|
+
|
|
2274
|
+
|
|
2275
|
+
|
|
2276
|
+
|
|
2277
|
+
|
|
2278
|
+
|
|
2279
|
+
|
|
2280
|
+
|
|
2281
|
+
|
|
2282
|
+
|
|
2283
|
+
|
|
2284
|
+
|
|
2285
|
+
|
|
2286
|
+
|
|
2287
|
+
|
|
2288
|
+
|
|
2289
|
+
|
|
2290
|
+
|
|
2291
|
+
|
|
2292
|
+
* @example
|
|
2293
|
+
* // Greatest key ≤ target
|
|
2294
|
+
* const mm = new TreeMultiMap<number, string>();
|
|
2295
|
+
* mm.add(10, 'a');
|
|
2296
|
+
* mm.add(20, 'b');
|
|
2297
|
+
* mm.add(30, 'c');
|
|
2298
|
+
* console.log(mm.floor(25)?.[0]); // 20;
|
|
2299
|
+
*/
|
|
2300
|
+
floor(key: K): [K, V[]] | undefined;
|
|
2301
|
+
/**
|
|
2302
|
+
* Returns the entry with the smallest key > given key.
|
|
2303
|
+
* @remarks Time O(log n), Space O(1)
|
|
2304
|
+
|
|
2305
|
+
|
|
2306
|
+
|
|
2307
|
+
|
|
2308
|
+
|
|
2309
|
+
|
|
2310
|
+
|
|
2311
|
+
|
|
2312
|
+
|
|
2313
|
+
|
|
2314
|
+
|
|
2315
|
+
|
|
2316
|
+
|
|
2317
|
+
|
|
2318
|
+
|
|
2319
|
+
|
|
2320
|
+
|
|
2321
|
+
|
|
2322
|
+
|
|
2323
|
+
|
|
2324
|
+
|
|
2325
|
+
|
|
2326
|
+
|
|
2327
|
+
|
|
2328
|
+
|
|
2329
|
+
|
|
2330
|
+
|
|
2331
|
+
|
|
2332
|
+
|
|
2333
|
+
|
|
2334
|
+
|
|
2335
|
+
|
|
2336
|
+
|
|
2337
|
+
|
|
2338
|
+
|
|
2339
|
+
|
|
2340
|
+
|
|
2341
|
+
|
|
2342
|
+
|
|
2343
|
+
|
|
2344
|
+
|
|
2345
|
+
|
|
2346
|
+
|
|
2347
|
+
|
|
2348
|
+
|
|
2349
|
+
|
|
2350
|
+
|
|
2351
|
+
|
|
2352
|
+
|
|
2353
|
+
|
|
2354
|
+
|
|
2355
|
+
|
|
2356
|
+
|
|
2357
|
+
|
|
2358
|
+
|
|
2359
|
+
|
|
2360
|
+
|
|
2361
|
+
|
|
2362
|
+
|
|
2363
|
+
|
|
2364
|
+
|
|
2365
|
+
|
|
2366
|
+
|
|
2367
|
+
|
|
2368
|
+
|
|
2369
|
+
|
|
2370
|
+
|
|
2371
|
+
|
|
2372
|
+
|
|
2373
|
+
|
|
2374
|
+
|
|
2375
|
+
|
|
2376
|
+
|
|
2377
|
+
|
|
2378
|
+
|
|
2379
|
+
|
|
2380
|
+
|
|
2381
|
+
|
|
2382
|
+
|
|
2383
|
+
|
|
2384
|
+
|
|
2385
|
+
|
|
2386
|
+
|
|
2387
|
+
|
|
2388
|
+
|
|
2389
|
+
|
|
2390
|
+
|
|
2391
|
+
|
|
2392
|
+
|
|
2393
|
+
|
|
2394
|
+
|
|
2395
|
+
|
|
2396
|
+
|
|
2397
|
+
|
|
2398
|
+
|
|
2399
|
+
|
|
2400
|
+
|
|
2401
|
+
|
|
2402
|
+
|
|
2403
|
+
|
|
2404
|
+
|
|
2405
|
+
|
|
2406
|
+
|
|
2407
|
+
|
|
2408
|
+
|
|
2409
|
+
|
|
2410
|
+
|
|
2411
|
+
|
|
2412
|
+
|
|
2413
|
+
|
|
2414
|
+
* @example
|
|
2415
|
+
* // Least key > target
|
|
2416
|
+
* const mm = new TreeMultiMap<number, string>();
|
|
2417
|
+
* mm.add(10, 'a');
|
|
2418
|
+
* mm.add(20, 'b');
|
|
2419
|
+
* console.log(mm.higher(10)?.[0]); // 20;
|
|
2420
|
+
*/
|
|
2421
|
+
higher(key: K): [K, V[]] | undefined;
|
|
2422
|
+
/**
|
|
2423
|
+
* Returns the entry with the largest key < given key.
|
|
2424
|
+
* @remarks Time O(log n), Space O(1)
|
|
2425
|
+
|
|
2426
|
+
|
|
2427
|
+
|
|
2428
|
+
|
|
2429
|
+
|
|
2430
|
+
|
|
2431
|
+
|
|
2432
|
+
|
|
2433
|
+
|
|
2434
|
+
|
|
2435
|
+
|
|
2436
|
+
|
|
2437
|
+
|
|
2438
|
+
|
|
2439
|
+
|
|
2440
|
+
|
|
2441
|
+
|
|
2442
|
+
|
|
2443
|
+
|
|
2444
|
+
|
|
2445
|
+
|
|
2446
|
+
|
|
2447
|
+
|
|
2448
|
+
|
|
2449
|
+
|
|
2450
|
+
|
|
2451
|
+
|
|
2452
|
+
|
|
2453
|
+
|
|
2454
|
+
|
|
2455
|
+
|
|
2456
|
+
|
|
2457
|
+
|
|
2458
|
+
|
|
2459
|
+
|
|
2460
|
+
|
|
2461
|
+
|
|
2462
|
+
|
|
2463
|
+
|
|
2464
|
+
|
|
2465
|
+
|
|
2466
|
+
|
|
2467
|
+
|
|
2468
|
+
|
|
2469
|
+
|
|
2470
|
+
|
|
2471
|
+
|
|
2472
|
+
|
|
2473
|
+
|
|
2474
|
+
|
|
2475
|
+
|
|
2476
|
+
|
|
2477
|
+
|
|
2478
|
+
|
|
2479
|
+
|
|
2480
|
+
|
|
2481
|
+
|
|
2482
|
+
|
|
2483
|
+
|
|
2484
|
+
|
|
2485
|
+
|
|
2486
|
+
|
|
2487
|
+
|
|
2488
|
+
|
|
2489
|
+
|
|
2490
|
+
|
|
2491
|
+
|
|
2492
|
+
|
|
2493
|
+
|
|
2494
|
+
|
|
2495
|
+
|
|
2496
|
+
|
|
2497
|
+
|
|
2498
|
+
|
|
2499
|
+
|
|
2500
|
+
|
|
2501
|
+
|
|
2502
|
+
|
|
2503
|
+
|
|
2504
|
+
|
|
2505
|
+
|
|
2506
|
+
|
|
2507
|
+
|
|
2508
|
+
|
|
2509
|
+
|
|
2510
|
+
|
|
2511
|
+
|
|
2512
|
+
|
|
2513
|
+
|
|
2514
|
+
|
|
2515
|
+
|
|
2516
|
+
|
|
2517
|
+
|
|
2518
|
+
|
|
2519
|
+
|
|
2520
|
+
|
|
2521
|
+
|
|
2522
|
+
|
|
2523
|
+
|
|
2524
|
+
|
|
2525
|
+
|
|
2526
|
+
|
|
2527
|
+
|
|
2528
|
+
|
|
2529
|
+
|
|
2530
|
+
|
|
2531
|
+
|
|
2532
|
+
|
|
2533
|
+
|
|
2534
|
+
|
|
2535
|
+
* @example
|
|
2536
|
+
* // Greatest key < target
|
|
2537
|
+
* const mm = new TreeMultiMap<number, string>();
|
|
2538
|
+
* mm.add(10, 'a');
|
|
2539
|
+
* mm.add(20, 'b');
|
|
2540
|
+
* console.log(mm.lower(20)?.[0]); // 10;
|
|
2541
|
+
*/
|
|
2542
|
+
lower(key: K): [K, V[]] | undefined;
|
|
2543
|
+
/**
|
|
2544
|
+
* Prints the internal tree structure (for debugging).
|
|
2545
|
+
* @remarks Time O(n), Space O(n)
|
|
2546
|
+
|
|
2547
|
+
|
|
2548
|
+
|
|
2549
|
+
|
|
2550
|
+
|
|
2551
|
+
|
|
2552
|
+
|
|
2553
|
+
|
|
2554
|
+
|
|
2555
|
+
|
|
2556
|
+
|
|
2557
|
+
|
|
2558
|
+
|
|
2559
|
+
|
|
2560
|
+
|
|
2561
|
+
|
|
2562
|
+
|
|
2563
|
+
|
|
2564
|
+
|
|
2565
|
+
|
|
2566
|
+
|
|
2567
|
+
|
|
2568
|
+
|
|
2569
|
+
|
|
2570
|
+
|
|
2571
|
+
|
|
2572
|
+
|
|
2573
|
+
|
|
2574
|
+
|
|
2575
|
+
|
|
2576
|
+
|
|
2577
|
+
|
|
2578
|
+
|
|
2579
|
+
|
|
2580
|
+
|
|
2581
|
+
|
|
2582
|
+
|
|
2583
|
+
|
|
2584
|
+
|
|
2585
|
+
|
|
2586
|
+
|
|
2587
|
+
|
|
2588
|
+
|
|
2589
|
+
|
|
2590
|
+
|
|
2591
|
+
|
|
2592
|
+
|
|
2593
|
+
|
|
2594
|
+
|
|
2595
|
+
|
|
2596
|
+
|
|
2597
|
+
|
|
2598
|
+
|
|
2599
|
+
|
|
2600
|
+
|
|
2601
|
+
|
|
2602
|
+
|
|
2603
|
+
|
|
2604
|
+
|
|
2605
|
+
|
|
2606
|
+
|
|
2607
|
+
|
|
2608
|
+
|
|
2609
|
+
|
|
2610
|
+
|
|
2611
|
+
|
|
2612
|
+
|
|
2613
|
+
|
|
2614
|
+
|
|
2615
|
+
|
|
2616
|
+
|
|
2617
|
+
|
|
2618
|
+
|
|
2619
|
+
|
|
2620
|
+
|
|
2621
|
+
|
|
2622
|
+
|
|
2623
|
+
|
|
2624
|
+
|
|
2625
|
+
|
|
2626
|
+
|
|
2627
|
+
|
|
2628
|
+
|
|
2629
|
+
|
|
2630
|
+
|
|
2631
|
+
|
|
2632
|
+
|
|
2633
|
+
|
|
2634
|
+
|
|
2635
|
+
|
|
2636
|
+
|
|
2637
|
+
|
|
2638
|
+
|
|
2639
|
+
|
|
2640
|
+
|
|
2641
|
+
|
|
2642
|
+
|
|
2643
|
+
|
|
2644
|
+
|
|
2645
|
+
|
|
2646
|
+
|
|
2647
|
+
|
|
2648
|
+
|
|
2649
|
+
|
|
2650
|
+
|
|
2651
|
+
|
|
2652
|
+
|
|
2653
|
+
|
|
2654
|
+
|
|
2655
|
+
|
|
2656
|
+
|
|
2657
|
+
|
|
2658
|
+
|
|
2659
|
+
|
|
2660
|
+
|
|
2661
|
+
|
|
2662
|
+
|
|
2663
|
+
|
|
2664
|
+
|
|
2665
|
+
|
|
2666
|
+
|
|
2667
|
+
|
|
2668
|
+
|
|
2669
|
+
|
|
2670
|
+
|
|
2671
|
+
|
|
2672
|
+
|
|
2673
|
+
|
|
2674
|
+
|
|
2675
|
+
|
|
2676
|
+
|
|
2677
|
+
|
|
2678
|
+
|
|
2679
|
+
|
|
2680
|
+
|
|
2681
|
+
|
|
2682
|
+
|
|
2683
|
+
|
|
2684
|
+
* @example
|
|
2685
|
+
* // Display tree
|
|
2686
|
+
* const mm = new TreeMultiMap<number, string>();
|
|
2687
|
+
* mm.add(1, 'a');
|
|
2688
|
+
* expect(() => mm.print()).not.toThrow();
|
|
2689
|
+
*/
|
|
2690
|
+
print(): void;
|
|
2691
|
+
/**
|
|
2692
|
+
* Executes a callback for each entry.
|
|
2693
|
+
* @remarks Time O(n), Space O(1)
|
|
2694
|
+
|
|
2695
|
+
|
|
2696
|
+
|
|
2697
|
+
|
|
2698
|
+
|
|
2699
|
+
|
|
2700
|
+
|
|
2701
|
+
|
|
2702
|
+
|
|
2703
|
+
|
|
2704
|
+
|
|
2705
|
+
|
|
2706
|
+
|
|
2707
|
+
|
|
2708
|
+
|
|
2709
|
+
|
|
2710
|
+
|
|
2711
|
+
|
|
2712
|
+
|
|
2713
|
+
|
|
2714
|
+
|
|
2715
|
+
|
|
2716
|
+
|
|
2717
|
+
|
|
2718
|
+
|
|
2719
|
+
|
|
2720
|
+
|
|
2721
|
+
|
|
2722
|
+
|
|
2723
|
+
|
|
2724
|
+
|
|
2725
|
+
|
|
2726
|
+
|
|
2727
|
+
|
|
2728
|
+
|
|
2729
|
+
|
|
2730
|
+
|
|
2731
|
+
|
|
2732
|
+
|
|
2733
|
+
|
|
2734
|
+
|
|
2735
|
+
|
|
2736
|
+
|
|
2737
|
+
|
|
2738
|
+
|
|
2739
|
+
|
|
2740
|
+
|
|
2741
|
+
|
|
2742
|
+
|
|
2743
|
+
|
|
2744
|
+
|
|
2745
|
+
|
|
2746
|
+
|
|
2747
|
+
|
|
2748
|
+
|
|
2749
|
+
|
|
2750
|
+
|
|
2751
|
+
|
|
2752
|
+
|
|
2753
|
+
|
|
2754
|
+
|
|
2755
|
+
|
|
2756
|
+
|
|
2757
|
+
|
|
2758
|
+
|
|
2759
|
+
|
|
2760
|
+
|
|
2761
|
+
|
|
2762
|
+
|
|
2763
|
+
|
|
2764
|
+
|
|
2765
|
+
|
|
2766
|
+
|
|
2767
|
+
|
|
2768
|
+
|
|
2769
|
+
|
|
2770
|
+
|
|
2771
|
+
|
|
2772
|
+
|
|
2773
|
+
|
|
2774
|
+
|
|
2775
|
+
|
|
2776
|
+
|
|
2777
|
+
|
|
2778
|
+
|
|
2779
|
+
|
|
2780
|
+
|
|
2781
|
+
|
|
2782
|
+
|
|
2783
|
+
|
|
2784
|
+
|
|
2785
|
+
|
|
2786
|
+
|
|
2787
|
+
|
|
2788
|
+
|
|
2789
|
+
|
|
2790
|
+
|
|
2791
|
+
|
|
2792
|
+
|
|
2793
|
+
|
|
2794
|
+
|
|
2795
|
+
|
|
2796
|
+
|
|
2797
|
+
|
|
2798
|
+
|
|
2799
|
+
|
|
2800
|
+
|
|
2801
|
+
|
|
2802
|
+
|
|
2803
|
+
|
|
2804
|
+
|
|
2805
|
+
|
|
2806
|
+
|
|
2807
|
+
|
|
2808
|
+
|
|
2809
|
+
|
|
2810
|
+
|
|
2811
|
+
|
|
2812
|
+
|
|
2813
|
+
|
|
2814
|
+
|
|
2815
|
+
|
|
2816
|
+
|
|
2817
|
+
|
|
2818
|
+
|
|
2819
|
+
|
|
2820
|
+
|
|
2821
|
+
|
|
2822
|
+
|
|
2823
|
+
|
|
2824
|
+
|
|
2825
|
+
|
|
2826
|
+
|
|
2827
|
+
|
|
2828
|
+
|
|
2829
|
+
|
|
2830
|
+
|
|
2831
|
+
|
|
2832
|
+
* @example
|
|
2833
|
+
* // Iterate entries
|
|
2834
|
+
* const mm = new TreeMultiMap<number, string>();
|
|
2835
|
+
* mm.add(1, 'a');
|
|
2836
|
+
* mm.add(2, 'b');
|
|
2837
|
+
* const keys: number[] = [];
|
|
2838
|
+
* mm.forEach((v, k) => keys.push(k));
|
|
2839
|
+
* console.log(keys); // [1, 2];
|
|
2840
|
+
*/
|
|
2841
|
+
forEach(callback: (value: V[], key: K, map: this) => void): void;
|
|
2842
|
+
/**
|
|
2843
|
+
* Creates a new map with entries that pass the predicate.
|
|
2844
|
+
* @remarks Time O(n), Space O(n)
|
|
2845
|
+
|
|
2846
|
+
|
|
2847
|
+
|
|
2848
|
+
|
|
2849
|
+
|
|
2850
|
+
|
|
2851
|
+
|
|
2852
|
+
|
|
2853
|
+
|
|
2854
|
+
|
|
2855
|
+
|
|
2856
|
+
|
|
2857
|
+
|
|
2858
|
+
|
|
2859
|
+
|
|
2860
|
+
|
|
2861
|
+
|
|
2862
|
+
|
|
2863
|
+
|
|
2864
|
+
|
|
2865
|
+
|
|
2866
|
+
|
|
2867
|
+
|
|
2868
|
+
|
|
2869
|
+
|
|
2870
|
+
|
|
2871
|
+
|
|
2872
|
+
|
|
2873
|
+
|
|
2874
|
+
|
|
2875
|
+
|
|
2876
|
+
|
|
2877
|
+
|
|
2878
|
+
|
|
2879
|
+
|
|
2880
|
+
|
|
2881
|
+
|
|
2882
|
+
|
|
2883
|
+
|
|
2884
|
+
|
|
2885
|
+
|
|
2886
|
+
|
|
2887
|
+
|
|
2888
|
+
|
|
2889
|
+
|
|
2890
|
+
|
|
2891
|
+
|
|
2892
|
+
|
|
2893
|
+
|
|
2894
|
+
|
|
2895
|
+
|
|
2896
|
+
|
|
2897
|
+
|
|
2898
|
+
|
|
2899
|
+
|
|
2900
|
+
|
|
2901
|
+
|
|
2902
|
+
|
|
2903
|
+
|
|
2904
|
+
|
|
2905
|
+
|
|
2906
|
+
|
|
2907
|
+
|
|
2908
|
+
|
|
2909
|
+
|
|
2910
|
+
|
|
2911
|
+
|
|
2912
|
+
|
|
2913
|
+
|
|
2914
|
+
|
|
2915
|
+
|
|
2916
|
+
|
|
2917
|
+
|
|
2918
|
+
|
|
2919
|
+
|
|
2920
|
+
|
|
2921
|
+
|
|
2922
|
+
|
|
2923
|
+
|
|
2924
|
+
|
|
2925
|
+
|
|
2926
|
+
|
|
2927
|
+
|
|
2928
|
+
|
|
2929
|
+
|
|
2930
|
+
|
|
2931
|
+
|
|
2932
|
+
|
|
2933
|
+
|
|
2934
|
+
|
|
2935
|
+
|
|
2936
|
+
|
|
2937
|
+
|
|
2938
|
+
|
|
2939
|
+
|
|
2940
|
+
|
|
2941
|
+
|
|
2942
|
+
|
|
2943
|
+
|
|
2944
|
+
|
|
2945
|
+
|
|
2946
|
+
|
|
2947
|
+
|
|
2948
|
+
|
|
2949
|
+
|
|
2950
|
+
|
|
2951
|
+
|
|
2952
|
+
|
|
2953
|
+
|
|
2954
|
+
|
|
2955
|
+
|
|
2956
|
+
|
|
2957
|
+
|
|
2958
|
+
|
|
2959
|
+
|
|
2960
|
+
|
|
2961
|
+
|
|
2962
|
+
|
|
2963
|
+
|
|
2964
|
+
|
|
2965
|
+
|
|
2966
|
+
|
|
2967
|
+
|
|
2968
|
+
|
|
2969
|
+
|
|
2970
|
+
|
|
2971
|
+
|
|
2972
|
+
|
|
2973
|
+
|
|
2974
|
+
|
|
2975
|
+
|
|
2976
|
+
|
|
2977
|
+
|
|
2978
|
+
|
|
2979
|
+
|
|
2980
|
+
|
|
2981
|
+
|
|
2982
|
+
|
|
2983
|
+
* @example
|
|
2984
|
+
* // Filter entries
|
|
2985
|
+
* const mm = new TreeMultiMap<number, string>();
|
|
2986
|
+
* mm.add(1, 'a');
|
|
2987
|
+
* mm.add(2, 'b');
|
|
2988
|
+
* mm.add(3, 'c');
|
|
2989
|
+
* const filtered = mm.filter((v, k) => k > 1);
|
|
2990
|
+
* console.log([...filtered.keys()]); // [2, 3];
|
|
2991
|
+
*/
|
|
2992
|
+
filter(predicate: (value: V[], key: K, map: this) => boolean): TreeMultiMap<K, V, R>;
|
|
2993
|
+
/**
|
|
2994
|
+
* Creates a new map by transforming each entry.
|
|
2995
|
+
* @remarks Time O(n log n), Space O(n)
|
|
2996
|
+
|
|
2997
|
+
|
|
2998
|
+
|
|
2999
|
+
|
|
3000
|
+
|
|
3001
|
+
|
|
3002
|
+
|
|
3003
|
+
|
|
3004
|
+
|
|
3005
|
+
|
|
3006
|
+
|
|
3007
|
+
|
|
3008
|
+
|
|
3009
|
+
|
|
3010
|
+
|
|
3011
|
+
|
|
3012
|
+
|
|
3013
|
+
|
|
3014
|
+
|
|
3015
|
+
|
|
3016
|
+
|
|
3017
|
+
|
|
3018
|
+
|
|
3019
|
+
|
|
3020
|
+
|
|
3021
|
+
|
|
3022
|
+
|
|
3023
|
+
|
|
3024
|
+
|
|
3025
|
+
|
|
3026
|
+
|
|
3027
|
+
|
|
3028
|
+
|
|
3029
|
+
|
|
3030
|
+
|
|
3031
|
+
|
|
3032
|
+
|
|
3033
|
+
|
|
3034
|
+
|
|
3035
|
+
|
|
3036
|
+
|
|
3037
|
+
|
|
3038
|
+
|
|
3039
|
+
|
|
3040
|
+
|
|
3041
|
+
|
|
3042
|
+
|
|
3043
|
+
|
|
3044
|
+
|
|
3045
|
+
|
|
3046
|
+
|
|
3047
|
+
|
|
3048
|
+
|
|
3049
|
+
|
|
3050
|
+
|
|
3051
|
+
|
|
3052
|
+
|
|
3053
|
+
|
|
3054
|
+
|
|
3055
|
+
|
|
3056
|
+
|
|
3057
|
+
|
|
3058
|
+
|
|
3059
|
+
|
|
3060
|
+
|
|
3061
|
+
|
|
3062
|
+
|
|
3063
|
+
|
|
3064
|
+
|
|
3065
|
+
|
|
3066
|
+
|
|
3067
|
+
|
|
3068
|
+
|
|
3069
|
+
|
|
3070
|
+
|
|
3071
|
+
|
|
3072
|
+
|
|
3073
|
+
|
|
3074
|
+
|
|
3075
|
+
|
|
3076
|
+
|
|
3077
|
+
|
|
3078
|
+
|
|
3079
|
+
|
|
3080
|
+
|
|
3081
|
+
|
|
3082
|
+
|
|
3083
|
+
|
|
3084
|
+
|
|
3085
|
+
|
|
3086
|
+
|
|
3087
|
+
|
|
3088
|
+
|
|
3089
|
+
|
|
3090
|
+
|
|
3091
|
+
|
|
3092
|
+
|
|
3093
|
+
|
|
3094
|
+
|
|
3095
|
+
|
|
3096
|
+
|
|
3097
|
+
|
|
3098
|
+
|
|
3099
|
+
|
|
3100
|
+
|
|
3101
|
+
|
|
3102
|
+
|
|
3103
|
+
|
|
3104
|
+
|
|
3105
|
+
|
|
3106
|
+
|
|
3107
|
+
|
|
3108
|
+
|
|
3109
|
+
|
|
3110
|
+
|
|
3111
|
+
|
|
3112
|
+
|
|
3113
|
+
|
|
3114
|
+
|
|
3115
|
+
|
|
3116
|
+
|
|
3117
|
+
|
|
3118
|
+
|
|
3119
|
+
|
|
3120
|
+
|
|
3121
|
+
|
|
3122
|
+
|
|
3123
|
+
|
|
3124
|
+
|
|
3125
|
+
|
|
3126
|
+
|
|
3127
|
+
|
|
3128
|
+
|
|
3129
|
+
|
|
3130
|
+
|
|
3131
|
+
|
|
3132
|
+
|
|
3133
|
+
|
|
3134
|
+
* @example
|
|
3135
|
+
* // Transform values
|
|
3136
|
+
* const mm = new TreeMultiMap<number, string>();
|
|
3137
|
+
* mm.add(1, 'a');
|
|
3138
|
+
* const mapped = mm.map((v, k) => [k, v.map(s => s.toUpperCase())] as [number, string[]]);
|
|
3139
|
+
* console.log(mapped.get(1)); // ['A'];
|
|
563
3140
|
*/
|
|
564
|
-
|
|
3141
|
+
map<V2>(mapper: (value: V[], key: K, map: this) => [K, V2[]]): TreeMultiMap<K, V2, R>;
|
|
565
3142
|
/**
|
|
566
|
-
*
|
|
3143
|
+
* Reduces all entries to a single value.
|
|
567
3144
|
* @remarks Time O(n), Space O(1)
|
|
568
3145
|
|
|
569
3146
|
|
|
@@ -603,58 +3180,12 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
603
3180
|
|
|
604
3181
|
|
|
605
3182
|
|
|
606
|
-
* @example
|
|
607
|
-
* // Iterate value arrays
|
|
608
|
-
* const mm = new TreeMultiMap<number, string>();
|
|
609
|
-
* mm.add(1, 'a');
|
|
610
|
-
* mm.add(1, 'b');
|
|
611
|
-
* console.log([...mm.values()]); // [['a', 'b']];
|
|
612
|
-
*/
|
|
613
|
-
values(): IterableIterator<V[]>;
|
|
614
|
-
/**
|
|
615
|
-
* Iterates over all entries for a specific key.
|
|
616
|
-
* @remarks Time O(log n + m), Space O(1) where m is bucket size
|
|
617
3183
|
|
|
618
3184
|
|
|
619
|
-
* @example
|
|
620
|
-
* // Get entries for key
|
|
621
|
-
* const mm = new TreeMultiMap<number, string>();
|
|
622
|
-
* mm.add(1, 'a');
|
|
623
|
-
* mm.add(1, 'b');
|
|
624
|
-
* console.log([...mm.entriesOf(1)]); // [[1, 'a'], [1, 'b']];
|
|
625
|
-
*/
|
|
626
|
-
entriesOf(key: K): IterableIterator<[K, V]>;
|
|
627
|
-
/**
|
|
628
|
-
* Iterates over all values for a specific key.
|
|
629
|
-
* @remarks Time O(log n + m), Space O(1) where m is bucket size
|
|
630
3185
|
|
|
631
3186
|
|
|
632
|
-
* @example
|
|
633
|
-
* // Get flat values for key
|
|
634
|
-
* const mm = new TreeMultiMap<number, string>();
|
|
635
|
-
* mm.add(1, 'a');
|
|
636
|
-
* mm.add(1, 'b');
|
|
637
|
-
* console.log([...mm.valuesOf(1)]); // ['a', 'b'];
|
|
638
|
-
*/
|
|
639
|
-
valuesOf(key: K): IterableIterator<V>;
|
|
640
|
-
/**
|
|
641
|
-
* Iterates over all [key, value] pairs (flattened from buckets).
|
|
642
|
-
* @remarks Time O(T), Space O(1) where T is totalSize
|
|
643
3187
|
|
|
644
3188
|
|
|
645
|
-
* @example
|
|
646
|
-
* // All key-value pairs flattened
|
|
647
|
-
* const mm = new TreeMultiMap<number, string>();
|
|
648
|
-
* mm.add(1, 'a');
|
|
649
|
-
* mm.add(1, 'b');
|
|
650
|
-
* mm.add(2, 'c');
|
|
651
|
-
* console.log([...mm.flatEntries()]); // [[1, 'a'], [1, 'b'], [2, 'c']];
|
|
652
|
-
*/
|
|
653
|
-
flatEntries(): IterableIterator<[K, V]>;
|
|
654
|
-
/**
|
|
655
|
-
* Returns the entry with the smallest key.
|
|
656
|
-
* @remarks Time O(log n), Space O(1)
|
|
657
|
-
|
|
658
3189
|
|
|
659
3190
|
|
|
660
3191
|
|
|
@@ -668,18 +3199,6 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
668
3199
|
|
|
669
3200
|
|
|
670
3201
|
|
|
671
|
-
* @example
|
|
672
|
-
* // First entry
|
|
673
|
-
* const mm = new TreeMultiMap<number, string>();
|
|
674
|
-
* mm.add(3, 'c');
|
|
675
|
-
* mm.add(1, 'a');
|
|
676
|
-
* console.log(mm.first()?.[0]); // 1;
|
|
677
|
-
*/
|
|
678
|
-
first(): [K, V[]] | undefined;
|
|
679
|
-
/**
|
|
680
|
-
* Returns the entry with the largest key.
|
|
681
|
-
* @remarks Time O(log n), Space O(1)
|
|
682
|
-
|
|
683
3202
|
|
|
684
3203
|
|
|
685
3204
|
|
|
@@ -693,49 +3212,10 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
693
3212
|
|
|
694
3213
|
|
|
695
3214
|
|
|
696
|
-
* @example
|
|
697
|
-
* // Last entry
|
|
698
|
-
* const mm = new TreeMultiMap<number, string>();
|
|
699
|
-
* mm.add(1, 'a');
|
|
700
|
-
* mm.add(3, 'c');
|
|
701
|
-
* console.log(mm.last()?.[0]); // 3;
|
|
702
|
-
*/
|
|
703
|
-
last(): [K, V[]] | undefined;
|
|
704
|
-
/**
|
|
705
|
-
* Removes and returns the entry with the smallest key.
|
|
706
|
-
* @remarks Time O(log n), Space O(1)
|
|
707
|
-
|
|
708
3215
|
|
|
709
3216
|
|
|
710
|
-
* @example
|
|
711
|
-
* // Remove and return first
|
|
712
|
-
* const mm = new TreeMultiMap<number, string>();
|
|
713
|
-
* mm.add(2, 'b');
|
|
714
|
-
* mm.add(1, 'a');
|
|
715
|
-
* const first = mm.pollFirst();
|
|
716
|
-
* console.log(first?.[0]); // 1;
|
|
717
|
-
* console.log(mm.has(1)); // false;
|
|
718
|
-
*/
|
|
719
|
-
pollFirst(): [K, V[]] | undefined;
|
|
720
|
-
/**
|
|
721
|
-
* Removes and returns the entry with the largest key.
|
|
722
|
-
* @remarks Time O(log n), Space O(1)
|
|
723
|
-
|
|
724
3217
|
|
|
725
3218
|
|
|
726
|
-
* @example
|
|
727
|
-
* // Remove and return last
|
|
728
|
-
* const mm = new TreeMultiMap<number, string>();
|
|
729
|
-
* mm.add(1, 'a');
|
|
730
|
-
* mm.add(3, 'c');
|
|
731
|
-
* const last = mm.pollLast();
|
|
732
|
-
* console.log(last?.[0]); // 3;
|
|
733
|
-
*/
|
|
734
|
-
pollLast(): [K, V[]] | undefined;
|
|
735
|
-
/**
|
|
736
|
-
* Returns the entry with the smallest key >= given key.
|
|
737
|
-
* @remarks Time O(log n), Space O(1)
|
|
738
|
-
|
|
739
3219
|
|
|
740
3220
|
|
|
741
3221
|
|
|
@@ -776,19 +3256,6 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
776
3256
|
|
|
777
3257
|
|
|
778
3258
|
|
|
779
|
-
* @example
|
|
780
|
-
* // Least key ≥ target
|
|
781
|
-
* const mm = new TreeMultiMap<number, string>();
|
|
782
|
-
* mm.add(10, 'a');
|
|
783
|
-
* mm.add(20, 'b');
|
|
784
|
-
* mm.add(30, 'c');
|
|
785
|
-
* console.log(mm.ceiling(15)?.[0]); // 20;
|
|
786
|
-
*/
|
|
787
|
-
ceiling(key: K): [K, V[]] | undefined;
|
|
788
|
-
/**
|
|
789
|
-
* Returns the entry with the largest key <= given key.
|
|
790
|
-
* @remarks Time O(log n), Space O(1)
|
|
791
|
-
|
|
792
3259
|
|
|
793
3260
|
|
|
794
3261
|
|
|
@@ -813,6 +3280,36 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
813
3280
|
|
|
814
3281
|
|
|
815
3282
|
|
|
3283
|
+
* @example
|
|
3284
|
+
* // Aggregate
|
|
3285
|
+
* const mm = new TreeMultiMap<number, number>();
|
|
3286
|
+
* mm.add(1, 10);
|
|
3287
|
+
* mm.add(2, 20);
|
|
3288
|
+
* const sum = mm.reduce((acc, v) => acc + v.reduce((a, b) => a + b, 0), 0);
|
|
3289
|
+
* console.log(sum); // 30;
|
|
3290
|
+
*/
|
|
3291
|
+
reduce<U>(callback: (accumulator: U, value: V[], key: K, map: this) => U, initialValue: U): U;
|
|
3292
|
+
/**
|
|
3293
|
+
* Sets multiple entries at once.
|
|
3294
|
+
* @remarks Time O(m log n), Space O(m) where m is input size
|
|
3295
|
+
|
|
3296
|
+
|
|
3297
|
+
|
|
3298
|
+
|
|
3299
|
+
|
|
3300
|
+
|
|
3301
|
+
|
|
3302
|
+
|
|
3303
|
+
|
|
3304
|
+
|
|
3305
|
+
|
|
3306
|
+
|
|
3307
|
+
|
|
3308
|
+
|
|
3309
|
+
|
|
3310
|
+
|
|
3311
|
+
|
|
3312
|
+
|
|
816
3313
|
|
|
817
3314
|
|
|
818
3315
|
|
|
@@ -829,19 +3326,6 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
829
3326
|
|
|
830
3327
|
|
|
831
3328
|
|
|
832
|
-
* @example
|
|
833
|
-
* // Greatest key ≤ target
|
|
834
|
-
* const mm = new TreeMultiMap<number, string>();
|
|
835
|
-
* mm.add(10, 'a');
|
|
836
|
-
* mm.add(20, 'b');
|
|
837
|
-
* mm.add(30, 'c');
|
|
838
|
-
* console.log(mm.floor(25)?.[0]); // 20;
|
|
839
|
-
*/
|
|
840
|
-
floor(key: K): [K, V[]] | undefined;
|
|
841
|
-
/**
|
|
842
|
-
* Returns the entry with the smallest key > given key.
|
|
843
|
-
* @remarks Time O(log n), Space O(1)
|
|
844
|
-
|
|
845
3329
|
|
|
846
3330
|
|
|
847
3331
|
|
|
@@ -871,18 +3355,6 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
871
3355
|
|
|
872
3356
|
|
|
873
3357
|
|
|
874
|
-
* @example
|
|
875
|
-
* // Least key > target
|
|
876
|
-
* const mm = new TreeMultiMap<number, string>();
|
|
877
|
-
* mm.add(10, 'a');
|
|
878
|
-
* mm.add(20, 'b');
|
|
879
|
-
* console.log(mm.higher(10)?.[0]); // 20;
|
|
880
|
-
*/
|
|
881
|
-
higher(key: K): [K, V[]] | undefined;
|
|
882
|
-
/**
|
|
883
|
-
* Returns the entry with the largest key < given key.
|
|
884
|
-
* @remarks Time O(log n), Space O(1)
|
|
885
|
-
|
|
886
3358
|
|
|
887
3359
|
|
|
888
3360
|
|
|
@@ -912,17 +3384,6 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
912
3384
|
|
|
913
3385
|
|
|
914
3386
|
|
|
915
|
-
* @example
|
|
916
|
-
* // Greatest key < target
|
|
917
|
-
* const mm = new TreeMultiMap<number, string>();
|
|
918
|
-
* mm.add(10, 'a');
|
|
919
|
-
* mm.add(20, 'b');
|
|
920
|
-
* console.log(mm.lower(20)?.[0]); // 10;
|
|
921
|
-
*/
|
|
922
|
-
lower(key: K): [K, V[]] | undefined;
|
|
923
|
-
/**
|
|
924
|
-
* Prints the internal tree structure (for debugging).
|
|
925
|
-
* @remarks Time O(n), Space O(n)
|
|
926
3387
|
|
|
927
3388
|
|
|
928
3389
|
|
|
@@ -962,19 +3423,15 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
962
3423
|
|
|
963
3424
|
|
|
964
3425
|
* @example
|
|
965
|
-
* //
|
|
3426
|
+
* // Set multiple entries
|
|
966
3427
|
* const mm = new TreeMultiMap<number, string>();
|
|
967
|
-
* mm.
|
|
968
|
-
*
|
|
3428
|
+
* mm.setMany([[1, ['a']], [2, ['b']]]);
|
|
3429
|
+
* console.log(mm.size); // 2;
|
|
969
3430
|
*/
|
|
970
|
-
|
|
3431
|
+
setMany(keysNodesEntriesOrRaws: Iterable<K | [K | null | undefined, V[] | undefined]>): boolean[];
|
|
971
3432
|
/**
|
|
972
|
-
*
|
|
973
|
-
* @remarks Time O(n), Space O(
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
3433
|
+
* Searches for entries within a key range.
|
|
3434
|
+
* @remarks Time O(log n + k), Space O(k) where k is result size
|
|
978
3435
|
|
|
979
3436
|
|
|
980
3437
|
|
|
@@ -1009,19 +3466,6 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
1009
3466
|
|
|
1010
3467
|
|
|
1011
3468
|
|
|
1012
|
-
* @example
|
|
1013
|
-
* // Iterate entries
|
|
1014
|
-
* const mm = new TreeMultiMap<number, string>();
|
|
1015
|
-
* mm.add(1, 'a');
|
|
1016
|
-
* mm.add(2, 'b');
|
|
1017
|
-
* const keys: number[] = [];
|
|
1018
|
-
* mm.forEach((v, k) => keys.push(k));
|
|
1019
|
-
* console.log(keys); // [1, 2];
|
|
1020
|
-
*/
|
|
1021
|
-
forEach(callback: (value: V[], key: K, map: this) => void): void;
|
|
1022
|
-
/**
|
|
1023
|
-
* Creates a new map with entries that pass the predicate.
|
|
1024
|
-
* @remarks Time O(n), Space O(n)
|
|
1025
3469
|
|
|
1026
3470
|
|
|
1027
3471
|
|
|
@@ -1060,19 +3504,6 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
1060
3504
|
|
|
1061
3505
|
|
|
1062
3506
|
|
|
1063
|
-
* @example
|
|
1064
|
-
* // Filter entries
|
|
1065
|
-
* const mm = new TreeMultiMap<number, string>();
|
|
1066
|
-
* mm.add(1, 'a');
|
|
1067
|
-
* mm.add(2, 'b');
|
|
1068
|
-
* mm.add(3, 'c');
|
|
1069
|
-
* const filtered = mm.filter((v, k) => k > 1);
|
|
1070
|
-
* console.log([...filtered.keys()]); // [2, 3];
|
|
1071
|
-
*/
|
|
1072
|
-
filter(predicate: (value: V[], key: K, map: this) => boolean): TreeMultiMap<K, V, R>;
|
|
1073
|
-
/**
|
|
1074
|
-
* Creates a new map by transforming each entry.
|
|
1075
|
-
* @remarks Time O(n log n), Space O(n)
|
|
1076
3507
|
|
|
1077
3508
|
|
|
1078
3509
|
|
|
@@ -1112,16 +3543,20 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
1112
3543
|
|
|
1113
3544
|
|
|
1114
3545
|
* @example
|
|
1115
|
-
* //
|
|
3546
|
+
* // Find keys in range
|
|
1116
3547
|
* const mm = new TreeMultiMap<number, string>();
|
|
1117
|
-
* mm.add(
|
|
1118
|
-
*
|
|
1119
|
-
*
|
|
3548
|
+
* mm.add(10, 'a');
|
|
3549
|
+
* mm.add(20, 'b');
|
|
3550
|
+
* mm.add(30, 'c');
|
|
3551
|
+
* const result = mm.rangeSearch([15, 25]);
|
|
3552
|
+
* console.log(result.length); // 1;
|
|
1120
3553
|
*/
|
|
1121
|
-
|
|
3554
|
+
rangeSearch<C extends (node: RedBlackTreeNode<K, V[]>) => unknown>(range: Range<K> | [K, K], callback?: C): ReturnType<C>[];
|
|
1122
3555
|
/**
|
|
1123
|
-
*
|
|
1124
|
-
* @remarks Time O(n), Space O(
|
|
3556
|
+
* Creates a shallow clone of this map.
|
|
3557
|
+
* @remarks Time O(n log n), Space O(n)
|
|
3558
|
+
|
|
3559
|
+
|
|
1125
3560
|
|
|
1126
3561
|
|
|
1127
3562
|
|
|
@@ -1160,18 +3595,6 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
1160
3595
|
|
|
1161
3596
|
|
|
1162
3597
|
|
|
1163
|
-
* @example
|
|
1164
|
-
* // Aggregate
|
|
1165
|
-
* const mm = new TreeMultiMap<number, number>();
|
|
1166
|
-
* mm.add(1, 10);
|
|
1167
|
-
* mm.add(2, 20);
|
|
1168
|
-
* const sum = mm.reduce((acc, v) => acc + v.reduce((a, b) => a + b, 0), 0);
|
|
1169
|
-
* console.log(sum); // 30;
|
|
1170
|
-
*/
|
|
1171
|
-
reduce<U>(callback: (accumulator: U, value: V[], key: K, map: this) => U, initialValue: U): U;
|
|
1172
|
-
/**
|
|
1173
|
-
* Sets multiple entries at once.
|
|
1174
|
-
* @remarks Time O(m log n), Space O(m) where m is input size
|
|
1175
3598
|
|
|
1176
3599
|
|
|
1177
3600
|
|
|
@@ -1202,16 +3625,6 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
1202
3625
|
|
|
1203
3626
|
|
|
1204
3627
|
|
|
1205
|
-
* @example
|
|
1206
|
-
* // Set multiple entries
|
|
1207
|
-
* const mm = new TreeMultiMap<number, string>();
|
|
1208
|
-
* mm.setMany([[1, ['a']], [2, ['b']]]);
|
|
1209
|
-
* console.log(mm.size); // 2;
|
|
1210
|
-
*/
|
|
1211
|
-
setMany(keysNodesEntriesOrRaws: Iterable<K | [K | null | undefined, V[] | undefined]>): boolean[];
|
|
1212
|
-
/**
|
|
1213
|
-
* Searches for entries within a key range.
|
|
1214
|
-
* @remarks Time O(log n + k), Space O(k) where k is result size
|
|
1215
3628
|
|
|
1216
3629
|
|
|
1217
3630
|
|
|
@@ -1242,19 +3655,6 @@ export declare class TreeMultiMap<K = any, V = any, R = any> implements Iterable
|
|
|
1242
3655
|
|
|
1243
3656
|
|
|
1244
3657
|
|
|
1245
|
-
* @example
|
|
1246
|
-
* // Find keys in range
|
|
1247
|
-
* const mm = new TreeMultiMap<number, string>();
|
|
1248
|
-
* mm.add(10, 'a');
|
|
1249
|
-
* mm.add(20, 'b');
|
|
1250
|
-
* mm.add(30, 'c');
|
|
1251
|
-
* const result = mm.rangeSearch([15, 25]);
|
|
1252
|
-
* console.log(result.length); // 1;
|
|
1253
|
-
*/
|
|
1254
|
-
rangeSearch<C extends (node: RedBlackTreeNode<K, V[]>) => unknown>(range: Range<K> | [K, K], callback?: C): ReturnType<C>[];
|
|
1255
|
-
/**
|
|
1256
|
-
* Creates a shallow clone of this map.
|
|
1257
|
-
* @remarks Time O(n log n), Space O(n)
|
|
1258
3658
|
|
|
1259
3659
|
|
|
1260
3660
|
|