binary-tree-typed 2.5.2 → 2.6.0
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/cjs/index.cjs +320 -55
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs-legacy/index.cjs +320 -55
- package/dist/cjs-legacy/index.cjs.map +1 -1
- package/dist/esm/index.mjs +320 -55
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm-legacy/index.mjs +320 -55
- package/dist/esm-legacy/index.mjs.map +1 -1
- package/dist/types/data-structures/base/iterable-element-base.d.ts +17 -0
- package/dist/types/data-structures/base/linear-base.d.ts +6 -0
- 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 +191 -15
- package/dist/types/data-structures/binary-tree/bst.d.ts +171 -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 +1061 -167
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +1232 -355
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +916 -194
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +1078 -141
- 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 +150 -2
- 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 +171 -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/umd/binary-tree-typed.js +320 -55
- package/dist/umd/binary-tree-typed.js.map +1 -1
- package/dist/umd/binary-tree-typed.min.js +5 -5
- package/dist/umd/binary-tree-typed.min.js.map +1 -1
- package/package.json +2 -2
- package/src/data-structures/base/iterable-element-base.ts +32 -0
- package/src/data-structures/base/linear-base.ts +11 -0
- package/src/data-structures/binary-tree/avl-tree.ts +88 -5
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +98 -0
- package/src/data-structures/binary-tree/binary-tree.ts +242 -81
- package/src/data-structures/binary-tree/bst.ts +173 -7
- package/src/data-structures/binary-tree/red-black-tree.ts +139 -15
- package/src/data-structures/binary-tree/segment-tree.ts +42 -0
- package/src/data-structures/binary-tree/tree-map.ts +948 -36
- package/src/data-structures/binary-tree/tree-multi-map.ts +893 -13
- package/src/data-structures/binary-tree/tree-multi-set.ts +761 -33
- package/src/data-structures/binary-tree/tree-set.ts +1260 -251
- 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 +100 -12
- package/src/data-structures/heap/heap.ts +149 -19
- package/src/data-structures/linked-list/doubly-linked-list.ts +178 -2
- package/src/data-structures/linked-list/singly-linked-list.ts +106 -1
- package/src/data-structures/linked-list/skip-linked-list.ts +126 -0
- package/src/data-structures/matrix/matrix.ts +56 -0
- package/src/data-structures/queue/deque.ts +187 -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 +84 -0
- package/src/interfaces/binary-tree.ts +1 -9
|
@@ -245,6 +245,13 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
245
245
|
|
|
246
246
|
|
|
247
247
|
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
|
|
248
255
|
|
|
249
256
|
|
|
250
257
|
|
|
@@ -299,6 +306,13 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
299
306
|
|
|
300
307
|
|
|
301
308
|
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
|
|
302
316
|
|
|
303
317
|
|
|
304
318
|
|
|
@@ -348,6 +362,13 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
348
362
|
|
|
349
363
|
|
|
350
364
|
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
351
372
|
|
|
352
373
|
|
|
353
374
|
|
|
@@ -393,6 +414,13 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
393
414
|
|
|
394
415
|
|
|
395
416
|
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
|
|
396
424
|
|
|
397
425
|
|
|
398
426
|
|
|
@@ -437,6 +465,13 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
437
465
|
|
|
438
466
|
|
|
439
467
|
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
|
|
440
475
|
|
|
441
476
|
|
|
442
477
|
|
|
@@ -484,6 +519,13 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
484
519
|
|
|
485
520
|
|
|
486
521
|
|
|
522
|
+
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
|
|
487
529
|
|
|
488
530
|
|
|
489
531
|
|
|
@@ -556,6 +598,13 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
556
598
|
|
|
557
599
|
|
|
558
600
|
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
|
|
559
608
|
|
|
560
609
|
|
|
561
610
|
|
|
@@ -611,6 +660,13 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
611
660
|
|
|
612
661
|
|
|
613
662
|
|
|
663
|
+
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
|
|
614
670
|
|
|
615
671
|
|
|
616
672
|
|
|
@@ -660,6 +716,13 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
660
716
|
|
|
661
717
|
|
|
662
718
|
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
|
|
663
726
|
|
|
664
727
|
|
|
665
728
|
|
|
@@ -709,6 +772,13 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
709
772
|
|
|
710
773
|
|
|
711
774
|
|
|
775
|
+
|
|
776
|
+
|
|
777
|
+
|
|
778
|
+
|
|
779
|
+
|
|
780
|
+
|
|
781
|
+
|
|
712
782
|
|
|
713
783
|
|
|
714
784
|
|
|
@@ -755,6 +825,13 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
755
825
|
|
|
756
826
|
|
|
757
827
|
|
|
828
|
+
|
|
829
|
+
|
|
830
|
+
|
|
831
|
+
|
|
832
|
+
|
|
833
|
+
|
|
834
|
+
|
|
758
835
|
|
|
759
836
|
|
|
760
837
|
|
|
@@ -796,6 +873,13 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
796
873
|
|
|
797
874
|
|
|
798
875
|
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
|
|
880
|
+
|
|
881
|
+
|
|
882
|
+
|
|
799
883
|
|
|
800
884
|
|
|
801
885
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BinaryTreeNode } from '../data-structures';
|
|
2
|
-
import type {
|
|
2
|
+
import type { BinaryTreeOptions, BTNRep, DFSOrderPattern, EntryCallback, IterationType, NodeCallback, NodePredicate, OptNodeOrNull, ReduceEntryCallback, ToEntryFn } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Public, implementation-agnostic binary tree API.
|
|
5
5
|
* K = key, V = value, R = raw/record used with toEntryFn (optional).
|
|
@@ -19,7 +19,7 @@ export interface IBinaryTree<K = any, V = any, R = any> {
|
|
|
19
19
|
add(keyOrNodeOrEntryOrRawElement: BTNRep<K, V, BinaryTreeNode<K, V>>, value?: V, count?: number): boolean;
|
|
20
20
|
set(keyOrNodeOrEntryOrRawElement: BTNRep<K, V, BinaryTreeNode<K, V>>, value?: V, count?: number): boolean;
|
|
21
21
|
addMany(keysNodesEntriesOrRaws: Iterable<K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | R>, values?: Iterable<V | undefined>): boolean[];
|
|
22
|
-
delete(keyNodeEntryRawOrPredicate: BTNRep<K, V, BinaryTreeNode<K, V>> | NodePredicate<BinaryTreeNode<K, V> | null>):
|
|
22
|
+
delete(keyNodeEntryRawOrPredicate: BTNRep<K, V, BinaryTreeNode<K, V>> | NodePredicate<BinaryTreeNode<K, V> | null>): boolean;
|
|
23
23
|
clear(): void;
|
|
24
24
|
isEmpty(): boolean;
|
|
25
25
|
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;
|
|
@@ -56,5 +56,4 @@ export interface IBinaryTree<K = any, V = any, R = any> {
|
|
|
56
56
|
filter(predicate: EntryCallback<K, V | undefined, boolean>, thisArg?: unknown): this;
|
|
57
57
|
map<MK = K, MV = V, MR = any>(callback: EntryCallback<K, V | undefined, [MK, MV]>, options?: Partial<BinaryTreeOptions<MK, MV, MR>>, thisArg?: unknown): IBinaryTree<MK, MV, MR>;
|
|
58
58
|
merge(anotherTree: IBinaryTree<K, V, R>): void;
|
|
59
|
-
refill(keysNodesEntriesOrRaws: Iterable<K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | R>, values?: Iterable<V | undefined>): void;
|
|
60
59
|
}
|