data-structure-typed 2.5.1 → 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 +5 -1
- package/MIGRATION.md +169 -0
- package/README.md +135 -23
- package/README_CN.md +551 -143
- package/SPECIFICATION.md +20 -14
- package/SPECIFICATION.zh-CN.md +20 -14
- package/dist/cjs/binary-tree.cjs +6460 -1591
- package/dist/cjs/graph.cjs +440 -20
- package/dist/cjs/hash.cjs +125 -22
- package/dist/cjs/heap.cjs +196 -47
- package/dist/cjs/index.cjs +8486 -2429
- package/dist/cjs/linked-list.cjs +456 -31
- package/dist/cjs/matrix.cjs +79 -9
- package/dist/cjs/priority-queue.cjs +193 -44
- package/dist/cjs/queue.cjs +391 -2
- package/dist/cjs/stack.cjs +92 -6
- package/dist/cjs/trie.cjs +122 -28
- package/dist/cjs-legacy/binary-tree.cjs +6484 -1612
- package/dist/cjs-legacy/graph.cjs +440 -20
- package/dist/cjs-legacy/hash.cjs +125 -22
- package/dist/cjs-legacy/heap.cjs +196 -47
- package/dist/cjs-legacy/index.cjs +8654 -2594
- package/dist/cjs-legacy/linked-list.cjs +456 -31
- package/dist/cjs-legacy/matrix.cjs +79 -9
- package/dist/cjs-legacy/priority-queue.cjs +193 -44
- package/dist/cjs-legacy/queue.cjs +391 -2
- package/dist/cjs-legacy/stack.cjs +92 -6
- package/dist/cjs-legacy/trie.cjs +122 -28
- package/dist/esm/binary-tree.mjs +6460 -1591
- package/dist/esm/graph.mjs +440 -20
- package/dist/esm/hash.mjs +125 -22
- package/dist/esm/heap.mjs +196 -47
- package/dist/esm/index.mjs +8486 -2430
- package/dist/esm/linked-list.mjs +456 -31
- package/dist/esm/matrix.mjs +79 -9
- package/dist/esm/priority-queue.mjs +193 -44
- package/dist/esm/queue.mjs +391 -2
- package/dist/esm/stack.mjs +92 -6
- package/dist/esm/trie.mjs +122 -28
- package/dist/esm-legacy/binary-tree.mjs +6484 -1612
- package/dist/esm-legacy/graph.mjs +440 -20
- package/dist/esm-legacy/hash.mjs +125 -22
- package/dist/esm-legacy/heap.mjs +196 -47
- package/dist/esm-legacy/index.mjs +8654 -2595
- package/dist/esm-legacy/linked-list.mjs +456 -31
- package/dist/esm-legacy/matrix.mjs +79 -9
- package/dist/esm-legacy/priority-queue.mjs +193 -44
- package/dist/esm-legacy/queue.mjs +391 -2
- package/dist/esm-legacy/stack.mjs +92 -6
- package/dist/esm-legacy/trie.mjs +122 -28
- package/dist/types/common/error.d.ts +9 -0
- package/dist/types/common/index.d.ts +1 -1
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +98 -2
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +112 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +214 -13
- package/dist/types/data-structures/binary-tree/bst.d.ts +294 -3
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +155 -8
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +48 -0
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +1370 -323
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +1329 -316
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +1116 -295
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +1330 -326
- package/dist/types/data-structures/graph/directed-graph.d.ts +80 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +72 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +95 -6
- package/dist/types/data-structures/heap/heap.d.ts +154 -12
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +143 -0
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +121 -1
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +144 -0
- package/dist/types/data-structures/matrix/matrix.d.ts +64 -0
- package/dist/types/data-structures/queue/deque.d.ts +142 -0
- package/dist/types/data-structures/queue/queue.d.ts +109 -0
- package/dist/types/data-structures/stack/stack.d.ts +82 -2
- package/dist/types/data-structures/trie/trie.d.ts +96 -0
- package/dist/types/interfaces/binary-tree.d.ts +2 -3
- package/dist/types/types/data-structures/binary-tree/bst.d.ts +1 -0
- package/dist/types/types/data-structures/binary-tree/tree-map.d.ts +5 -0
- package/dist/types/types/data-structures/binary-tree/tree-multi-set.d.ts +4 -0
- package/dist/types/types/data-structures/binary-tree/tree-set.d.ts +4 -0
- package/dist/umd/data-structure-typed.js +8623 -2564
- package/dist/umd/data-structure-typed.min.js +5 -5
- package/docs-site-docusaurus/docs/api/classes/AVLTree.md +696 -194
- package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +11 -11
- package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +71 -71
- package/docs-site-docusaurus/docs/api/classes/BST.md +639 -189
- 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 +148 -160
- package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/Deque.md +105 -91
- package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +82 -82
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +104 -74
- 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 +51 -51
- 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 +33 -33
- package/docs-site-docusaurus/docs/api/classes/LinearBase.md +50 -50
- package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +55 -55
- package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +55 -55
- package/docs-site-docusaurus/docs/api/classes/LinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +78 -78
- package/docs-site-docusaurus/docs/api/classes/MapGraph.md +82 -82
- 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 +112 -60
- package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +708 -206
- package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +10 -10
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +79 -79
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/SkipList.md +44 -44
- package/docs-site-docusaurus/docs/api/classes/Stack.md +42 -42
- package/docs-site-docusaurus/docs/api/classes/TreeMap.md +236 -33
- package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +162 -46
- package/docs-site-docusaurus/docs/api/classes/TreeSet.md +232 -32
- package/docs-site-docusaurus/docs/api/classes/Trie.md +47 -47
- package/docs-site-docusaurus/docs/api/classes/TrieNode.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +81 -81
- package/docs-site-docusaurus/docs/guide/architecture.md +75 -5
- package/docs-site-docusaurus/docs/guide/concepts.md +53 -3
- package/docs-site-docusaurus/docs/guide/faq.md +233 -0
- package/docs-site-docusaurus/docs/guide/guides.md +43 -58
- package/docs-site-docusaurus/docs/guide/installation.md +2 -0
- package/docs-site-docusaurus/docs/guide/integrations.md +75 -176
- package/docs-site-docusaurus/docs/guide/overview.md +132 -11
- package/docs-site-docusaurus/docs/guide/performance.md +2 -0
- package/docs-site-docusaurus/docs/guide/quick-start.md +31 -0
- package/docs-site-docusaurus/docs/guide/use-cases/_category_.json +6 -0
- package/docs-site-docusaurus/docs/guide/use-cases/array-sort-alternative.md +158 -0
- package/docs-site-docusaurus/docs/guide/use-cases/heap-vs-sorting.md +92 -0
- package/docs-site-docusaurus/docs/guide/use-cases/map-vs-treemap.md +151 -0
- package/docs-site-docusaurus/docs/guide/use-cases/priority-queue-typescript.md +113 -0
- package/docs-site-docusaurus/docs/guide/use-cases/treemap-javascript.md +151 -0
- package/docs-site-docusaurus/docusaurus.config.ts +1 -1
- package/docs-site-docusaurus/src/pages/index.tsx +55 -2
- package/docs-site-docusaurus/static/llms.txt +37 -0
- package/docs-site-docusaurus/typedoc.json +1 -0
- package/llms.txt +37 -0
- package/package.json +65 -56
- package/src/common/error.ts +19 -1
- package/src/common/index.ts +1 -1
- package/src/data-structures/base/iterable-element-base.ts +3 -2
- package/src/data-structures/binary-tree/avl-tree.ts +99 -5
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +102 -4
- package/src/data-structures/binary-tree/binary-tree.ts +239 -78
- package/src/data-structures/binary-tree/bst.ts +542 -13
- package/src/data-structures/binary-tree/red-black-tree.ts +155 -15
- package/src/data-structures/binary-tree/segment-tree.ts +42 -0
- package/src/data-structures/binary-tree/tree-map.ts +1223 -261
- package/src/data-structures/binary-tree/tree-multi-map.ts +939 -30
- package/src/data-structures/binary-tree/tree-multi-set.ts +746 -10
- package/src/data-structures/binary-tree/tree-set.ts +1018 -99
- package/src/data-structures/graph/abstract-graph.ts +2 -2
- package/src/data-structures/graph/directed-graph.ts +71 -1
- package/src/data-structures/graph/undirected-graph.ts +64 -1
- package/src/data-structures/hash/hash-map.ts +102 -16
- package/src/data-structures/heap/heap.ts +153 -23
- package/src/data-structures/heap/max-heap.ts +2 -2
- package/src/data-structures/linked-list/doubly-linked-list.ts +139 -0
- package/src/data-structures/linked-list/singly-linked-list.ts +106 -1
- package/src/data-structures/linked-list/skip-linked-list.ts +131 -5
- package/src/data-structures/matrix/matrix.ts +65 -9
- package/src/data-structures/priority-queue/max-priority-queue.ts +2 -2
- package/src/data-structures/queue/deque.ts +130 -0
- package/src/data-structures/queue/queue.ts +109 -0
- package/src/data-structures/stack/stack.ts +75 -5
- package/src/data-structures/trie/trie.ts +86 -2
- package/src/interfaces/binary-tree.ts +1 -9
- package/src/types/data-structures/binary-tree/bst.ts +1 -0
- package/src/types/data-structures/binary-tree/tree-map.ts +6 -0
- package/src/types/data-structures/binary-tree/tree-multi-set.ts +5 -0
- package/src/types/data-structures/binary-tree/tree-set.ts +5 -0
- package/.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
|
@@ -66,6 +66,22 @@ export declare class BinaryIndexedTree implements Iterable<number> {
|
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
69
85
|
|
|
70
86
|
|
|
71
87
|
|
|
@@ -131,6 +147,22 @@ export declare class BinaryIndexedTree implements Iterable<number> {
|
|
|
131
147
|
|
|
132
148
|
|
|
133
149
|
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
134
166
|
|
|
135
167
|
|
|
136
168
|
|
|
@@ -195,6 +227,22 @@ export declare class BinaryIndexedTree implements Iterable<number> {
|
|
|
195
227
|
|
|
196
228
|
|
|
197
229
|
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
198
246
|
|
|
199
247
|
|
|
200
248
|
|
|
@@ -260,6 +308,22 @@ export declare class BinaryIndexedTree implements Iterable<number> {
|
|
|
260
308
|
|
|
261
309
|
|
|
262
310
|
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
|
|
263
327
|
|
|
264
328
|
|
|
265
329
|
|
|
@@ -323,6 +387,22 @@ export declare class BinaryIndexedTree implements Iterable<number> {
|
|
|
323
387
|
|
|
324
388
|
|
|
325
389
|
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
|
|
326
406
|
|
|
327
407
|
|
|
328
408
|
|
|
@@ -389,6 +469,22 @@ export declare class BinaryIndexedTree implements Iterable<number> {
|
|
|
389
469
|
|
|
390
470
|
|
|
391
471
|
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
|
|
487
|
+
|
|
392
488
|
|
|
393
489
|
|
|
394
490
|
|
|
@@ -431,6 +527,14 @@ export declare class BinaryIndexedTree implements Iterable<number> {
|
|
|
431
527
|
|
|
432
528
|
|
|
433
529
|
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
|
|
434
538
|
|
|
435
539
|
|
|
436
540
|
|
|
@@ -467,6 +571,14 @@ export declare class BinaryIndexedTree implements Iterable<number> {
|
|
|
467
571
|
|
|
468
572
|
|
|
469
573
|
|
|
574
|
+
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
|
|
470
582
|
|
|
471
583
|
|
|
472
584
|
|
|
@@ -353,7 +353,7 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
353
353
|
isValidKey(key: unknown): key is K;
|
|
354
354
|
/**
|
|
355
355
|
* Adds a new node to the tree.
|
|
356
|
-
* @remarks Time O(
|
|
356
|
+
* @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).
|
|
357
357
|
*
|
|
358
358
|
* @param keyNodeOrEntry - The key, node, or entry to add.
|
|
359
359
|
* @returns True if the addition was successful, false otherwise.
|
|
@@ -374,6 +374,14 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
374
374
|
|
|
375
375
|
|
|
376
376
|
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
|
|
377
385
|
|
|
378
386
|
|
|
379
387
|
|
|
@@ -395,7 +403,7 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
395
403
|
add(keyNodeOrEntry: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined): boolean;
|
|
396
404
|
/**
|
|
397
405
|
* Adds or updates a new node to the tree.
|
|
398
|
-
* @remarks Time O(
|
|
406
|
+
* @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).
|
|
399
407
|
*
|
|
400
408
|
* @param keyNodeOrEntry - The key, node, or entry to set or update.
|
|
401
409
|
* @param [value] - The value, if providing just a key.
|
|
@@ -422,6 +430,14 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
422
430
|
|
|
423
431
|
|
|
424
432
|
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
|
|
425
441
|
|
|
426
442
|
|
|
427
443
|
|
|
@@ -482,6 +498,14 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
482
498
|
|
|
483
499
|
|
|
484
500
|
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
|
|
485
509
|
|
|
486
510
|
|
|
487
511
|
|
|
@@ -518,6 +542,14 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
518
542
|
|
|
519
543
|
|
|
520
544
|
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
|
|
521
553
|
|
|
522
554
|
|
|
523
555
|
|
|
@@ -559,6 +591,14 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
559
591
|
|
|
560
592
|
|
|
561
593
|
|
|
594
|
+
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
|
|
598
|
+
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
|
|
562
602
|
|
|
563
603
|
|
|
564
604
|
|
|
@@ -577,19 +617,28 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
577
617
|
*/
|
|
578
618
|
merge(anotherTree: BinaryTree<K, V, R>): void;
|
|
579
619
|
/**
|
|
580
|
-
*
|
|
581
|
-
* @remarks Time O(N)
|
|
620
|
+
* Deletes a node from the tree (internal, returns balancing metadata).
|
|
621
|
+
* @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).
|
|
622
|
+
* @internal Used by AVL/BST subclasses that need balancing metadata after deletion.
|
|
582
623
|
*
|
|
583
|
-
* @param
|
|
584
|
-
* @
|
|
624
|
+
* @param keyNodeEntryRawOrPredicate - The node to delete.
|
|
625
|
+
* @returns An array containing deletion results with balancing metadata.
|
|
585
626
|
*/
|
|
586
|
-
|
|
627
|
+
protected _deleteInternal(keyNodeEntryRawOrPredicate: BTNRep<K, V, BinaryTreeNode<K, V>> | NodePredicate<BinaryTreeNode<K, V> | null>): BinaryTreeDeleteResult<BinaryTreeNode<K, V>>[];
|
|
587
628
|
/**
|
|
588
629
|
* Deletes a node from the tree.
|
|
589
|
-
* @remarks Time O(
|
|
630
|
+
* @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).
|
|
590
631
|
*
|
|
591
632
|
* @param keyNodeEntryRawOrPredicate - The node to delete.
|
|
592
|
-
* @returns
|
|
633
|
+
* @returns True if the node was found and deleted, false otherwise.
|
|
634
|
+
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
|
|
593
642
|
|
|
594
643
|
|
|
595
644
|
|
|
@@ -628,7 +677,7 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
628
677
|
* console.log(tree.has(3)); // false;
|
|
629
678
|
* console.log(tree.size); // 4;
|
|
630
679
|
*/
|
|
631
|
-
delete(keyNodeEntryRawOrPredicate: BTNRep<K, V, BinaryTreeNode<K, V>> | NodePredicate<BinaryTreeNode<K, V> | null>):
|
|
680
|
+
delete(keyNodeEntryRawOrPredicate: BTNRep<K, V, BinaryTreeNode<K, V>> | NodePredicate<BinaryTreeNode<K, V> | null>): boolean;
|
|
632
681
|
/**
|
|
633
682
|
* Search by predicate
|
|
634
683
|
|
|
@@ -644,6 +693,14 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
644
693
|
|
|
645
694
|
|
|
646
695
|
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
|
|
647
704
|
|
|
648
705
|
|
|
649
706
|
|
|
@@ -689,6 +746,14 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
689
746
|
|
|
690
747
|
|
|
691
748
|
|
|
749
|
+
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
|
|
756
|
+
|
|
692
757
|
|
|
693
758
|
|
|
694
759
|
|
|
@@ -707,7 +772,7 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
707
772
|
getNodes(keyNodeEntryOrPredicate: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | NodePredicate<BinaryTreeNode<K, V>>, onlyOne?: boolean, startNode?: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, iterationType?: IterationType): BinaryTreeNode<K, V>[];
|
|
708
773
|
/**
|
|
709
774
|
* Gets the first node matching a predicate.
|
|
710
|
-
* @remarks Time O(
|
|
775
|
+
* @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.
|
|
711
776
|
*
|
|
712
777
|
* @param keyNodeEntryOrPredicate - The key, node, entry, or predicate function to search for.
|
|
713
778
|
* @param [startNode=this._root] - The node to start the search from.
|
|
@@ -733,6 +798,14 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
733
798
|
|
|
734
799
|
|
|
735
800
|
|
|
801
|
+
|
|
802
|
+
|
|
803
|
+
|
|
804
|
+
|
|
805
|
+
|
|
806
|
+
|
|
807
|
+
|
|
808
|
+
|
|
736
809
|
|
|
737
810
|
|
|
738
811
|
|
|
@@ -750,7 +823,7 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
750
823
|
getNode(keyNodeEntryOrPredicate: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | NodePredicate<BinaryTreeNode<K, V> | null>, startNode?: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, iterationType?: IterationType): BinaryTreeNode<K, V> | null | undefined;
|
|
751
824
|
/**
|
|
752
825
|
* Gets the value associated with a key.
|
|
753
|
-
* @remarks Time O(
|
|
826
|
+
* @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).
|
|
754
827
|
*
|
|
755
828
|
* @param keyNodeEntryOrPredicate - The key, node, or entry to get the value for.
|
|
756
829
|
* @param [startNode=this._root] - The node to start searching from (if not in Map mode).
|
|
@@ -778,6 +851,14 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
778
851
|
|
|
779
852
|
|
|
780
853
|
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
|
|
857
|
+
|
|
858
|
+
|
|
859
|
+
|
|
860
|
+
|
|
861
|
+
|
|
781
862
|
|
|
782
863
|
|
|
783
864
|
|
|
@@ -796,7 +877,7 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
796
877
|
get(keyNodeEntryOrPredicate: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, startNode?: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, iterationType?: IterationType): V | undefined;
|
|
797
878
|
/**
|
|
798
879
|
* Checks if a node matching the predicate exists in the tree.
|
|
799
|
-
* @remarks Time O(
|
|
880
|
+
* @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.
|
|
800
881
|
*
|
|
801
882
|
* @param [keyNodeEntryOrPredicate] - The key, node, entry, or predicate to check for.
|
|
802
883
|
* @param [startNode] - The node to start the search from.
|
|
@@ -824,6 +905,14 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
824
905
|
|
|
825
906
|
|
|
826
907
|
|
|
908
|
+
|
|
909
|
+
|
|
910
|
+
|
|
911
|
+
|
|
912
|
+
|
|
913
|
+
|
|
914
|
+
|
|
915
|
+
|
|
827
916
|
|
|
828
917
|
|
|
829
918
|
|
|
@@ -886,6 +975,14 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
886
975
|
|
|
887
976
|
|
|
888
977
|
|
|
978
|
+
|
|
979
|
+
|
|
980
|
+
|
|
981
|
+
|
|
982
|
+
|
|
983
|
+
|
|
984
|
+
|
|
985
|
+
|
|
889
986
|
|
|
890
987
|
|
|
891
988
|
|
|
@@ -927,6 +1024,14 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
927
1024
|
|
|
928
1025
|
|
|
929
1026
|
|
|
1027
|
+
|
|
1028
|
+
|
|
1029
|
+
|
|
1030
|
+
|
|
1031
|
+
|
|
1032
|
+
|
|
1033
|
+
|
|
1034
|
+
|
|
930
1035
|
|
|
931
1036
|
|
|
932
1037
|
|
|
@@ -976,6 +1081,14 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
976
1081
|
|
|
977
1082
|
|
|
978
1083
|
|
|
1084
|
+
|
|
1085
|
+
|
|
1086
|
+
|
|
1087
|
+
|
|
1088
|
+
|
|
1089
|
+
|
|
1090
|
+
|
|
1091
|
+
|
|
979
1092
|
|
|
980
1093
|
|
|
981
1094
|
|
|
@@ -1021,6 +1134,14 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
1021
1134
|
|
|
1022
1135
|
|
|
1023
1136
|
|
|
1137
|
+
|
|
1138
|
+
|
|
1139
|
+
|
|
1140
|
+
|
|
1141
|
+
|
|
1142
|
+
|
|
1143
|
+
|
|
1144
|
+
|
|
1024
1145
|
|
|
1025
1146
|
|
|
1026
1147
|
|
|
@@ -1066,6 +1187,14 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
1066
1187
|
|
|
1067
1188
|
|
|
1068
1189
|
|
|
1190
|
+
|
|
1191
|
+
|
|
1192
|
+
|
|
1193
|
+
|
|
1194
|
+
|
|
1195
|
+
|
|
1196
|
+
|
|
1197
|
+
|
|
1069
1198
|
|
|
1070
1199
|
|
|
1071
1200
|
|
|
@@ -1136,6 +1265,14 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
1136
1265
|
|
|
1137
1266
|
|
|
1138
1267
|
|
|
1268
|
+
|
|
1269
|
+
|
|
1270
|
+
|
|
1271
|
+
|
|
1272
|
+
|
|
1273
|
+
|
|
1274
|
+
|
|
1275
|
+
|
|
1139
1276
|
|
|
1140
1277
|
|
|
1141
1278
|
|
|
@@ -1178,6 +1315,14 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
1178
1315
|
|
|
1179
1316
|
|
|
1180
1317
|
|
|
1318
|
+
|
|
1319
|
+
|
|
1320
|
+
|
|
1321
|
+
|
|
1322
|
+
|
|
1323
|
+
|
|
1324
|
+
|
|
1325
|
+
|
|
1181
1326
|
|
|
1182
1327
|
|
|
1183
1328
|
|
|
@@ -1240,6 +1385,14 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
1240
1385
|
|
|
1241
1386
|
|
|
1242
1387
|
|
|
1388
|
+
|
|
1389
|
+
|
|
1390
|
+
|
|
1391
|
+
|
|
1392
|
+
|
|
1393
|
+
|
|
1394
|
+
|
|
1395
|
+
|
|
1243
1396
|
|
|
1244
1397
|
|
|
1245
1398
|
|
|
@@ -1278,6 +1431,14 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
1278
1431
|
|
|
1279
1432
|
|
|
1280
1433
|
|
|
1434
|
+
|
|
1435
|
+
|
|
1436
|
+
|
|
1437
|
+
|
|
1438
|
+
|
|
1439
|
+
|
|
1440
|
+
|
|
1441
|
+
|
|
1281
1442
|
|
|
1282
1443
|
|
|
1283
1444
|
|
|
@@ -1318,6 +1479,14 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
1318
1479
|
|
|
1319
1480
|
|
|
1320
1481
|
|
|
1482
|
+
|
|
1483
|
+
|
|
1484
|
+
|
|
1485
|
+
|
|
1486
|
+
|
|
1487
|
+
|
|
1488
|
+
|
|
1489
|
+
|
|
1321
1490
|
|
|
1322
1491
|
|
|
1323
1492
|
|
|
@@ -1360,6 +1529,14 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
1360
1529
|
|
|
1361
1530
|
|
|
1362
1531
|
|
|
1532
|
+
|
|
1533
|
+
|
|
1534
|
+
|
|
1535
|
+
|
|
1536
|
+
|
|
1537
|
+
|
|
1538
|
+
|
|
1539
|
+
|
|
1363
1540
|
|
|
1364
1541
|
|
|
1365
1542
|
|
|
@@ -1404,6 +1581,14 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
1404
1581
|
|
|
1405
1582
|
|
|
1406
1583
|
|
|
1584
|
+
|
|
1585
|
+
|
|
1586
|
+
|
|
1587
|
+
|
|
1588
|
+
|
|
1589
|
+
|
|
1590
|
+
|
|
1591
|
+
|
|
1407
1592
|
|
|
1408
1593
|
|
|
1409
1594
|
|
|
@@ -1451,6 +1636,14 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
1451
1636
|
|
|
1452
1637
|
|
|
1453
1638
|
|
|
1639
|
+
|
|
1640
|
+
|
|
1641
|
+
|
|
1642
|
+
|
|
1643
|
+
|
|
1644
|
+
|
|
1645
|
+
|
|
1646
|
+
|
|
1454
1647
|
|
|
1455
1648
|
|
|
1456
1649
|
|
|
@@ -1502,6 +1695,14 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
1502
1695
|
|
|
1503
1696
|
|
|
1504
1697
|
|
|
1698
|
+
|
|
1699
|
+
|
|
1700
|
+
|
|
1701
|
+
|
|
1702
|
+
|
|
1703
|
+
|
|
1704
|
+
|
|
1705
|
+
|
|
1505
1706
|
|
|
1506
1707
|
|
|
1507
1708
|
|