tree-multimap-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/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 +86 -2
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +98 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +189 -13
- package/dist/types/data-structures/binary-tree/bst.d.ts +270 -3
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +136 -8
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +42 -0
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +1089 -161
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +1243 -350
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +980 -255
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +1174 -284
- package/dist/types/data-structures/graph/directed-graph.d.ts +70 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +63 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +84 -6
- package/dist/types/data-structures/heap/heap.d.ts +140 -12
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +126 -0
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +106 -1
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +126 -0
- package/dist/types/data-structures/matrix/matrix.d.ts +56 -0
- package/dist/types/data-structures/queue/deque.d.ts +127 -0
- package/dist/types/data-structures/queue/queue.d.ts +97 -0
- package/dist/types/data-structures/stack/stack.d.ts +72 -2
- package/dist/types/data-structures/trie/trie.d.ts +84 -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/tree-multimap-typed.js +8759 -2700
- package/dist/umd/tree-multimap-typed.js.map +1 -1
- package/dist/umd/tree-multimap-typed.min.js +5 -5
- package/dist/umd/tree-multimap-typed.min.js.map +1 -1
- package/package.json +2 -2
- package/src/common/error.ts +19 -1
- package/src/common/index.ts +1 -1
- package/src/data-structures/base/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
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized error dispatch.
|
|
3
|
+
* All library errors go through this function for consistent messaging and easy grep.
|
|
4
|
+
* @remarks Always throws — data structure errors are never recoverable.
|
|
5
|
+
* @param ErrorClass - The error constructor (Error, TypeError, RangeError, etc.)
|
|
6
|
+
* @param message - The error message.
|
|
7
|
+
*/
|
|
8
|
+
export declare function raise(ErrorClass: new (msg: string) => Error, message: string): never;
|
|
1
9
|
/**
|
|
2
10
|
* Centralized error message templates.
|
|
3
11
|
* Keep using native Error/TypeError/RangeError — this only standardizes messages.
|
|
@@ -20,4 +28,5 @@ export declare const ERR: {
|
|
|
20
28
|
readonly matrixNotSquare: () => string;
|
|
21
29
|
readonly matrixNotRectangular: () => string;
|
|
22
30
|
readonly matrixRowMismatch: (expected: number, got: number) => string;
|
|
31
|
+
readonly orderStatisticNotEnabled: (method: string, ctx?: string) => string;
|
|
23
32
|
};
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
8
|
import { BST } from './bst';
|
|
9
|
-
import type { AVLTreeOptions,
|
|
9
|
+
import type { AVLTreeOptions, BinaryTreeOptions, BSTNOptKeyOrNode, EntryCallback, FamilyPosition, IterationType, RBTNColor } from '../../types';
|
|
10
10
|
import { IBinaryTree } from '../../interfaces';
|
|
11
11
|
/**
|
|
12
12
|
* Represents a Node in an AVL (Adelson-Velsky and Landis) Tree.
|
|
@@ -366,6 +366,34 @@ export declare class AVLTree<K = any, V = any, R = any> extends BST<K, V, R> imp
|
|
|
366
366
|
|
|
367
367
|
|
|
368
368
|
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
|
|
369
397
|
|
|
370
398
|
|
|
371
399
|
|
|
@@ -476,6 +504,27 @@ export declare class AVLTree<K = any, V = any, R = any> extends BST<K, V, R> imp
|
|
|
476
504
|
|
|
477
505
|
|
|
478
506
|
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
|
|
479
528
|
|
|
480
529
|
|
|
481
530
|
|
|
@@ -504,7 +553,7 @@ export declare class AVLTree<K = any, V = any, R = any> extends BST<K, V, R> imp
|
|
|
504
553
|
* console.log(avl.has(3)); // false;
|
|
505
554
|
* console.log(avl.size); // 6;
|
|
506
555
|
*/
|
|
507
|
-
delete(keyNodeOrEntry: K | AVLTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined):
|
|
556
|
+
delete(keyNodeOrEntry: K | AVLTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined): boolean;
|
|
508
557
|
/**
|
|
509
558
|
* Rebuilds the tree to be perfectly balanced.
|
|
510
559
|
* @remarks AVL trees are already height-balanced, but this makes them *perfectly* balanced (minimal height and all leaves at N or N-1).
|
|
@@ -551,6 +600,20 @@ export declare class AVLTree<K = any, V = any, R = any> extends BST<K, V, R> imp
|
|
|
551
600
|
|
|
552
601
|
|
|
553
602
|
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
|
|
554
617
|
|
|
555
618
|
|
|
556
619
|
|
|
@@ -651,6 +714,27 @@ export declare class AVLTree<K = any, V = any, R = any> extends BST<K, V, R> imp
|
|
|
651
714
|
|
|
652
715
|
|
|
653
716
|
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
|
|
727
|
+
|
|
728
|
+
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
|
|
733
|
+
|
|
734
|
+
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
|
|
654
738
|
|
|
655
739
|
|
|
656
740
|
|
|
@@ -70,6 +70,20 @@ export declare class BinaryIndexedTree implements Iterable<number> {
|
|
|
70
70
|
|
|
71
71
|
|
|
72
72
|
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
73
87
|
|
|
74
88
|
|
|
75
89
|
|
|
@@ -137,6 +151,20 @@ export declare class BinaryIndexedTree implements Iterable<number> {
|
|
|
137
151
|
|
|
138
152
|
|
|
139
153
|
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
140
168
|
|
|
141
169
|
|
|
142
170
|
|
|
@@ -203,6 +231,20 @@ export declare class BinaryIndexedTree implements Iterable<number> {
|
|
|
203
231
|
|
|
204
232
|
|
|
205
233
|
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
206
248
|
|
|
207
249
|
|
|
208
250
|
|
|
@@ -270,6 +312,20 @@ export declare class BinaryIndexedTree implements Iterable<number> {
|
|
|
270
312
|
|
|
271
313
|
|
|
272
314
|
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
|
|
273
329
|
|
|
274
330
|
|
|
275
331
|
|
|
@@ -335,6 +391,20 @@ export declare class BinaryIndexedTree implements Iterable<number> {
|
|
|
335
391
|
|
|
336
392
|
|
|
337
393
|
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
|
|
338
408
|
|
|
339
409
|
|
|
340
410
|
|
|
@@ -403,6 +473,20 @@ export declare class BinaryIndexedTree implements Iterable<number> {
|
|
|
403
473
|
|
|
404
474
|
|
|
405
475
|
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
|
|
406
490
|
|
|
407
491
|
|
|
408
492
|
|
|
@@ -445,6 +529,13 @@ export declare class BinaryIndexedTree implements Iterable<number> {
|
|
|
445
529
|
|
|
446
530
|
|
|
447
531
|
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
|
|
448
539
|
|
|
449
540
|
|
|
450
541
|
|
|
@@ -482,6 +573,13 @@ export declare class BinaryIndexedTree implements Iterable<number> {
|
|
|
482
573
|
|
|
483
574
|
|
|
484
575
|
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
|
|
485
583
|
|
|
486
584
|
|
|
487
585
|
|
|
@@ -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.
|
|
@@ -376,6 +376,13 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
376
376
|
|
|
377
377
|
|
|
378
378
|
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
|
|
379
386
|
|
|
380
387
|
|
|
381
388
|
|
|
@@ -396,7 +403,7 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
396
403
|
add(keyNodeOrEntry: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined): boolean;
|
|
397
404
|
/**
|
|
398
405
|
* Adds or updates a new node to the tree.
|
|
399
|
-
* @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).
|
|
400
407
|
*
|
|
401
408
|
* @param keyNodeOrEntry - The key, node, or entry to set or update.
|
|
402
409
|
* @param [value] - The value, if providing just a key.
|
|
@@ -425,6 +432,13 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
425
432
|
|
|
426
433
|
|
|
427
434
|
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
|
|
428
442
|
|
|
429
443
|
|
|
430
444
|
|
|
@@ -486,6 +500,13 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
486
500
|
|
|
487
501
|
|
|
488
502
|
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
|
|
489
510
|
|
|
490
511
|
|
|
491
512
|
|
|
@@ -523,6 +544,13 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
523
544
|
|
|
524
545
|
|
|
525
546
|
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
|
|
526
554
|
|
|
527
555
|
|
|
528
556
|
|
|
@@ -565,6 +593,13 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
565
593
|
|
|
566
594
|
|
|
567
595
|
|
|
596
|
+
|
|
597
|
+
|
|
598
|
+
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
|
|
568
603
|
|
|
569
604
|
|
|
570
605
|
|
|
@@ -582,19 +617,27 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
582
617
|
*/
|
|
583
618
|
merge(anotherTree: BinaryTree<K, V, R>): void;
|
|
584
619
|
/**
|
|
585
|
-
*
|
|
586
|
-
* @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.
|
|
587
623
|
*
|
|
588
|
-
* @param
|
|
589
|
-
* @
|
|
624
|
+
* @param keyNodeEntryRawOrPredicate - The node to delete.
|
|
625
|
+
* @returns An array containing deletion results with balancing metadata.
|
|
590
626
|
*/
|
|
591
|
-
|
|
627
|
+
protected _deleteInternal(keyNodeEntryRawOrPredicate: BTNRep<K, V, BinaryTreeNode<K, V>> | NodePredicate<BinaryTreeNode<K, V> | null>): BinaryTreeDeleteResult<BinaryTreeNode<K, V>>[];
|
|
592
628
|
/**
|
|
593
629
|
* Deletes a node from the tree.
|
|
594
|
-
* @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).
|
|
595
631
|
*
|
|
596
632
|
* @param keyNodeEntryRawOrPredicate - The node to delete.
|
|
597
|
-
* @returns
|
|
633
|
+
* @returns True if the node was found and deleted, false otherwise.
|
|
634
|
+
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
|
|
598
641
|
|
|
599
642
|
|
|
600
643
|
|
|
@@ -634,7 +677,7 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
634
677
|
* console.log(tree.has(3)); // false;
|
|
635
678
|
* console.log(tree.size); // 4;
|
|
636
679
|
*/
|
|
637
|
-
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;
|
|
638
681
|
/**
|
|
639
682
|
* Search by predicate
|
|
640
683
|
|
|
@@ -652,6 +695,13 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
652
695
|
|
|
653
696
|
|
|
654
697
|
|
|
698
|
+
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
|
|
655
705
|
|
|
656
706
|
|
|
657
707
|
|
|
@@ -698,6 +748,13 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
698
748
|
|
|
699
749
|
|
|
700
750
|
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
|
|
701
758
|
|
|
702
759
|
|
|
703
760
|
|
|
@@ -715,7 +772,7 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
715
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>[];
|
|
716
773
|
/**
|
|
717
774
|
* Gets the first node matching a predicate.
|
|
718
|
-
* @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.
|
|
719
776
|
*
|
|
720
777
|
* @param keyNodeEntryOrPredicate - The key, node, entry, or predicate function to search for.
|
|
721
778
|
* @param [startNode=this._root] - The node to start the search from.
|
|
@@ -743,6 +800,13 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
743
800
|
|
|
744
801
|
|
|
745
802
|
|
|
803
|
+
|
|
804
|
+
|
|
805
|
+
|
|
806
|
+
|
|
807
|
+
|
|
808
|
+
|
|
809
|
+
|
|
746
810
|
|
|
747
811
|
|
|
748
812
|
|
|
@@ -759,7 +823,7 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
759
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;
|
|
760
824
|
/**
|
|
761
825
|
* Gets the value associated with a key.
|
|
762
|
-
* @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).
|
|
763
827
|
*
|
|
764
828
|
* @param keyNodeEntryOrPredicate - The key, node, or entry to get the value for.
|
|
765
829
|
* @param [startNode=this._root] - The node to start searching from (if not in Map mode).
|
|
@@ -789,6 +853,13 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
789
853
|
|
|
790
854
|
|
|
791
855
|
|
|
856
|
+
|
|
857
|
+
|
|
858
|
+
|
|
859
|
+
|
|
860
|
+
|
|
861
|
+
|
|
862
|
+
|
|
792
863
|
|
|
793
864
|
|
|
794
865
|
|
|
@@ -806,7 +877,7 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
806
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;
|
|
807
878
|
/**
|
|
808
879
|
* Checks if a node matching the predicate exists in the tree.
|
|
809
|
-
* @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.
|
|
810
881
|
*
|
|
811
882
|
* @param [keyNodeEntryOrPredicate] - The key, node, entry, or predicate to check for.
|
|
812
883
|
* @param [startNode] - The node to start the search from.
|
|
@@ -836,6 +907,13 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
836
907
|
|
|
837
908
|
|
|
838
909
|
|
|
910
|
+
|
|
911
|
+
|
|
912
|
+
|
|
913
|
+
|
|
914
|
+
|
|
915
|
+
|
|
916
|
+
|
|
839
917
|
|
|
840
918
|
|
|
841
919
|
|
|
@@ -899,6 +977,13 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
899
977
|
|
|
900
978
|
|
|
901
979
|
|
|
980
|
+
|
|
981
|
+
|
|
982
|
+
|
|
983
|
+
|
|
984
|
+
|
|
985
|
+
|
|
986
|
+
|
|
902
987
|
|
|
903
988
|
|
|
904
989
|
|
|
@@ -941,6 +1026,13 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
941
1026
|
|
|
942
1027
|
|
|
943
1028
|
|
|
1029
|
+
|
|
1030
|
+
|
|
1031
|
+
|
|
1032
|
+
|
|
1033
|
+
|
|
1034
|
+
|
|
1035
|
+
|
|
944
1036
|
|
|
945
1037
|
|
|
946
1038
|
|
|
@@ -991,6 +1083,13 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
991
1083
|
|
|
992
1084
|
|
|
993
1085
|
|
|
1086
|
+
|
|
1087
|
+
|
|
1088
|
+
|
|
1089
|
+
|
|
1090
|
+
|
|
1091
|
+
|
|
1092
|
+
|
|
994
1093
|
|
|
995
1094
|
|
|
996
1095
|
|
|
@@ -1037,6 +1136,13 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
1037
1136
|
|
|
1038
1137
|
|
|
1039
1138
|
|
|
1139
|
+
|
|
1140
|
+
|
|
1141
|
+
|
|
1142
|
+
|
|
1143
|
+
|
|
1144
|
+
|
|
1145
|
+
|
|
1040
1146
|
|
|
1041
1147
|
|
|
1042
1148
|
|
|
@@ -1083,6 +1189,13 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
1083
1189
|
|
|
1084
1190
|
|
|
1085
1191
|
|
|
1192
|
+
|
|
1193
|
+
|
|
1194
|
+
|
|
1195
|
+
|
|
1196
|
+
|
|
1197
|
+
|
|
1198
|
+
|
|
1086
1199
|
|
|
1087
1200
|
|
|
1088
1201
|
|
|
@@ -1154,6 +1267,13 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
1154
1267
|
|
|
1155
1268
|
|
|
1156
1269
|
|
|
1270
|
+
|
|
1271
|
+
|
|
1272
|
+
|
|
1273
|
+
|
|
1274
|
+
|
|
1275
|
+
|
|
1276
|
+
|
|
1157
1277
|
|
|
1158
1278
|
|
|
1159
1279
|
|
|
@@ -1197,6 +1317,13 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
1197
1317
|
|
|
1198
1318
|
|
|
1199
1319
|
|
|
1320
|
+
|
|
1321
|
+
|
|
1322
|
+
|
|
1323
|
+
|
|
1324
|
+
|
|
1325
|
+
|
|
1326
|
+
|
|
1200
1327
|
|
|
1201
1328
|
|
|
1202
1329
|
|
|
@@ -1260,6 +1387,13 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
1260
1387
|
|
|
1261
1388
|
|
|
1262
1389
|
|
|
1390
|
+
|
|
1391
|
+
|
|
1392
|
+
|
|
1393
|
+
|
|
1394
|
+
|
|
1395
|
+
|
|
1396
|
+
|
|
1263
1397
|
|
|
1264
1398
|
|
|
1265
1399
|
|
|
@@ -1299,6 +1433,13 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
1299
1433
|
|
|
1300
1434
|
|
|
1301
1435
|
|
|
1436
|
+
|
|
1437
|
+
|
|
1438
|
+
|
|
1439
|
+
|
|
1440
|
+
|
|
1441
|
+
|
|
1442
|
+
|
|
1302
1443
|
|
|
1303
1444
|
|
|
1304
1445
|
|
|
@@ -1340,6 +1481,13 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
1340
1481
|
|
|
1341
1482
|
|
|
1342
1483
|
|
|
1484
|
+
|
|
1485
|
+
|
|
1486
|
+
|
|
1487
|
+
|
|
1488
|
+
|
|
1489
|
+
|
|
1490
|
+
|
|
1343
1491
|
|
|
1344
1492
|
|
|
1345
1493
|
|
|
@@ -1383,6 +1531,13 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
1383
1531
|
|
|
1384
1532
|
|
|
1385
1533
|
|
|
1534
|
+
|
|
1535
|
+
|
|
1536
|
+
|
|
1537
|
+
|
|
1538
|
+
|
|
1539
|
+
|
|
1540
|
+
|
|
1386
1541
|
|
|
1387
1542
|
|
|
1388
1543
|
|
|
@@ -1428,6 +1583,13 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
1428
1583
|
|
|
1429
1584
|
|
|
1430
1585
|
|
|
1586
|
+
|
|
1587
|
+
|
|
1588
|
+
|
|
1589
|
+
|
|
1590
|
+
|
|
1591
|
+
|
|
1592
|
+
|
|
1431
1593
|
|
|
1432
1594
|
|
|
1433
1595
|
|
|
@@ -1476,6 +1638,13 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
1476
1638
|
|
|
1477
1639
|
|
|
1478
1640
|
|
|
1641
|
+
|
|
1642
|
+
|
|
1643
|
+
|
|
1644
|
+
|
|
1645
|
+
|
|
1646
|
+
|
|
1647
|
+
|
|
1479
1648
|
|
|
1480
1649
|
|
|
1481
1650
|
|
|
@@ -1528,6 +1697,13 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
|
|
|
1528
1697
|
|
|
1529
1698
|
|
|
1530
1699
|
|
|
1700
|
+
|
|
1701
|
+
|
|
1702
|
+
|
|
1703
|
+
|
|
1704
|
+
|
|
1705
|
+
|
|
1706
|
+
|
|
1531
1707
|
|
|
1532
1708
|
|
|
1533
1709
|
|