undirected-graph-typed 1.51.9 → 1.52.2
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/data-structures/base/index.d.ts +2 -1
- package/dist/data-structures/base/index.js +2 -1
- package/dist/data-structures/base/iterable-element-base.d.ts +171 -0
- package/dist/data-structures/base/iterable-element-base.js +225 -0
- package/dist/data-structures/base/{iterable-base.d.ts → iterable-entry-base.d.ts} +4 -147
- package/dist/data-structures/base/{iterable-base.js → iterable-entry-base.js} +12 -189
- package/dist/data-structures/binary-tree/avl-tree-multi-map.d.ts +13 -13
- package/dist/data-structures/binary-tree/avl-tree-multi-map.js +6 -6
- package/dist/data-structures/binary-tree/avl-tree.d.ts +13 -13
- package/dist/data-structures/binary-tree/avl-tree.js +6 -6
- package/dist/data-structures/binary-tree/binary-tree.d.ts +99 -99
- package/dist/data-structures/binary-tree/binary-tree.js +56 -54
- package/dist/data-structures/binary-tree/bst.d.ts +37 -45
- package/dist/data-structures/binary-tree/bst.js +19 -27
- package/dist/data-structures/binary-tree/rb-tree.d.ts +10 -10
- package/dist/data-structures/binary-tree/rb-tree.js +6 -6
- package/dist/data-structures/binary-tree/tree-multi-map.d.ts +12 -12
- package/dist/data-structures/binary-tree/tree-multi-map.js +5 -5
- package/dist/data-structures/graph/directed-graph.js +2 -1
- package/dist/data-structures/hash/hash-map.d.ts +2 -2
- package/dist/data-structures/heap/heap.d.ts +43 -114
- package/dist/data-structures/heap/heap.js +59 -127
- package/dist/data-structures/heap/max-heap.d.ts +50 -4
- package/dist/data-structures/heap/max-heap.js +76 -10
- package/dist/data-structures/heap/min-heap.d.ts +51 -5
- package/dist/data-structures/heap/min-heap.js +68 -11
- package/dist/data-structures/linked-list/doubly-linked-list.d.ts +22 -28
- package/dist/data-structures/linked-list/doubly-linked-list.js +26 -28
- package/dist/data-structures/linked-list/singly-linked-list.d.ts +22 -25
- package/dist/data-structures/linked-list/singly-linked-list.js +29 -26
- package/dist/data-structures/priority-queue/max-priority-queue.d.ts +50 -4
- package/dist/data-structures/priority-queue/max-priority-queue.js +79 -10
- package/dist/data-structures/priority-queue/min-priority-queue.d.ts +51 -5
- package/dist/data-structures/priority-queue/min-priority-queue.js +71 -11
- package/dist/data-structures/priority-queue/priority-queue.d.ts +50 -4
- package/dist/data-structures/priority-queue/priority-queue.js +70 -1
- package/dist/data-structures/queue/deque.d.ts +27 -18
- package/dist/data-structures/queue/deque.js +43 -21
- package/dist/data-structures/queue/queue.d.ts +26 -29
- package/dist/data-structures/queue/queue.js +47 -38
- package/dist/data-structures/stack/stack.d.ts +17 -22
- package/dist/data-structures/stack/stack.js +25 -24
- package/dist/data-structures/trie/trie.d.ts +18 -13
- package/dist/data-structures/trie/trie.js +26 -15
- package/dist/interfaces/binary-tree.d.ts +4 -4
- package/dist/types/common.d.ts +1 -22
- package/dist/types/data-structures/base/base.d.ts +5 -2
- package/dist/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +2 -3
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +2 -3
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +20 -4
- package/dist/types/data-structures/binary-tree/bst.d.ts +5 -3
- package/dist/types/data-structures/binary-tree/rb-tree.d.ts +2 -3
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +2 -3
- package/dist/types/data-structures/heap/heap.d.ts +3 -2
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +2 -1
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +2 -1
- package/dist/types/data-structures/priority-queue/priority-queue.d.ts +1 -1
- package/dist/types/data-structures/queue/deque.d.ts +4 -2
- package/dist/types/data-structures/queue/queue.d.ts +4 -1
- package/dist/types/data-structures/stack/stack.d.ts +2 -1
- package/dist/types/data-structures/trie/trie.d.ts +3 -2
- package/package.json +2 -2
- package/src/data-structures/base/index.ts +2 -1
- package/src/data-structures/base/iterable-element-base.ts +250 -0
- package/src/data-structures/base/{iterable-base.ts → iterable-entry-base.ts} +26 -217
- package/src/data-structures/binary-tree/avl-tree-multi-map.ts +26 -26
- package/src/data-structures/binary-tree/avl-tree.ts +21 -21
- package/src/data-structures/binary-tree/binary-tree.ts +166 -161
- package/src/data-structures/binary-tree/bst.ts +61 -68
- package/src/data-structures/binary-tree/rb-tree.ts +19 -19
- package/src/data-structures/binary-tree/tree-multi-map.ts +19 -19
- package/src/data-structures/graph/abstract-graph.ts +15 -14
- package/src/data-structures/graph/directed-graph.ts +9 -7
- package/src/data-structures/graph/undirected-graph.ts +7 -6
- package/src/data-structures/hash/hash-map.ts +8 -8
- package/src/data-structures/heap/heap.ts +72 -153
- package/src/data-structures/heap/max-heap.ts +88 -13
- package/src/data-structures/heap/min-heap.ts +78 -15
- package/src/data-structures/linked-list/doubly-linked-list.ts +33 -33
- package/src/data-structures/linked-list/singly-linked-list.ts +38 -30
- package/src/data-structures/priority-queue/max-priority-queue.ts +94 -13
- package/src/data-structures/priority-queue/min-priority-queue.ts +84 -15
- package/src/data-structures/priority-queue/priority-queue.ts +81 -4
- package/src/data-structures/queue/deque.ts +53 -28
- package/src/data-structures/queue/queue.ts +61 -44
- package/src/data-structures/stack/stack.ts +32 -27
- package/src/data-structures/trie/trie.ts +34 -19
- package/src/interfaces/binary-tree.ts +4 -5
- package/src/types/common.ts +2 -24
- package/src/types/data-structures/base/base.ts +14 -6
- package/src/types/data-structures/binary-tree/avl-tree-multi-map.ts +2 -3
- package/src/types/data-structures/binary-tree/avl-tree.ts +2 -3
- package/src/types/data-structures/binary-tree/binary-tree.ts +24 -5
- package/src/types/data-structures/binary-tree/bst.ts +9 -3
- package/src/types/data-structures/binary-tree/rb-tree.ts +2 -3
- package/src/types/data-structures/binary-tree/tree-multi-map.ts +2 -3
- package/src/types/data-structures/graph/abstract-graph.ts +8 -8
- package/src/types/data-structures/heap/heap.ts +4 -1
- package/src/types/data-structures/linked-list/doubly-linked-list.ts +3 -1
- package/src/types/data-structures/linked-list/singly-linked-list.ts +3 -1
- package/src/types/data-structures/priority-queue/priority-queue.ts +1 -1
- package/src/types/data-structures/queue/deque.ts +6 -1
- package/src/types/data-structures/queue/queue.ts +5 -1
- package/src/types/data-structures/stack/stack.ts +3 -1
- package/src/types/data-structures/trie/trie.ts +3 -1
- package/src/types/utils/utils.ts +4 -4
|
@@ -93,21 +93,27 @@ export class TrieNode {
|
|
|
93
93
|
* 10. IP Routing: Used in certain types of IP routing algorithms.
|
|
94
94
|
* 11. Text Word Frequency Count: Counting and storing the frequency of words in a large amount of text data.
|
|
95
95
|
*/
|
|
96
|
-
export class Trie extends IterableElementBase<string, Trie
|
|
96
|
+
export class Trie<R = any> extends IterableElementBase<string, R, Trie<R>> {
|
|
97
97
|
/**
|
|
98
98
|
* The constructor function for the Trie class.
|
|
99
99
|
* @param words: Iterable string Initialize the trie with a set of words
|
|
100
100
|
* @param options?: TrieOptions Allow the user to pass in options for the trie
|
|
101
101
|
* @return This
|
|
102
102
|
*/
|
|
103
|
-
constructor(words: Iterable<string> = [], options?: TrieOptions) {
|
|
104
|
-
super();
|
|
103
|
+
constructor(words: Iterable<string> | Iterable<R> = [], options?: TrieOptions<R>) {
|
|
104
|
+
super(options);
|
|
105
105
|
if (options) {
|
|
106
106
|
const { caseSensitive } = options;
|
|
107
107
|
if (caseSensitive !== undefined) this._caseSensitive = caseSensitive;
|
|
108
108
|
}
|
|
109
109
|
if (words) {
|
|
110
|
-
for (const word of words)
|
|
110
|
+
for (const word of words) {
|
|
111
|
+
if (this.toElementFn) {
|
|
112
|
+
this.add(this.toElementFn(word as R));
|
|
113
|
+
} else {
|
|
114
|
+
this.add(word as string);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
111
117
|
}
|
|
112
118
|
}
|
|
113
119
|
|
|
@@ -470,8 +476,8 @@ export class Trie extends IterableElementBase<string, Trie> {
|
|
|
470
476
|
* sensitivity as the original Trie.
|
|
471
477
|
* @returns A new instance of the Trie class is being returned.
|
|
472
478
|
*/
|
|
473
|
-
clone(): Trie {
|
|
474
|
-
return new Trie(this
|
|
479
|
+
clone(): Trie<R> {
|
|
480
|
+
return new Trie<R>(this, { caseSensitive: this.caseSensitive, toElementFn: this.toElementFn });
|
|
475
481
|
}
|
|
476
482
|
|
|
477
483
|
/**
|
|
@@ -493,8 +499,8 @@ export class Trie extends IterableElementBase<string, Trie> {
|
|
|
493
499
|
* specific object as the context for the `predicate` function. If `thisArg` is provided, it will be
|
|
494
500
|
* @returns The `filter` method is returning an array of strings (`string[]`).
|
|
495
501
|
*/
|
|
496
|
-
filter(predicate: ElementCallback<string, boolean
|
|
497
|
-
const results
|
|
502
|
+
filter(predicate: ElementCallback<string, R, boolean, Trie<R>>, thisArg?: any): Trie<R> {
|
|
503
|
+
const results = new Trie<R>([], { toElementFn: this.toElementFn, caseSensitive: this.caseSensitive });
|
|
498
504
|
let index = 0;
|
|
499
505
|
for (const word of this) {
|
|
500
506
|
if (predicate.call(thisArg, word, index, this)) {
|
|
@@ -514,17 +520,26 @@ export class Trie extends IterableElementBase<string, Trie> {
|
|
|
514
520
|
* Time Complexity: O(n)
|
|
515
521
|
* Space Complexity: O(n)
|
|
516
522
|
*
|
|
517
|
-
* The `map` function creates a new Trie by applying a callback function to each element in the
|
|
523
|
+
* The `map` function creates a new Trie by applying a callback function to each element in the
|
|
524
|
+
* current Trie.
|
|
518
525
|
* @param callback - The callback parameter is a function that will be called for each element in the
|
|
519
|
-
* Trie. It takes
|
|
520
|
-
*
|
|
521
|
-
*
|
|
522
|
-
*
|
|
523
|
-
*
|
|
524
|
-
* @
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
526
|
+
* Trie. It takes four arguments:
|
|
527
|
+
* @param [toElementFn] - The `toElementFn` parameter is an optional function that can be used to
|
|
528
|
+
* convert the raw element (`RM`) into a string representation. This can be useful if the raw element
|
|
529
|
+
* is not already a string or if you want to customize how the element is converted into a string. If
|
|
530
|
+
* this parameter is
|
|
531
|
+
* @param {any} [thisArg] - The `thisArg` parameter is an optional argument that allows you to
|
|
532
|
+
* specify the value of `this` within the callback function. It is used to set the context or scope
|
|
533
|
+
* in which the callback function will be executed. If `thisArg` is provided, it will be used as the
|
|
534
|
+
* value of
|
|
535
|
+
* @returns a new Trie object.
|
|
536
|
+
*/
|
|
537
|
+
map<RM>(
|
|
538
|
+
callback: ElementCallback<string, R, string, Trie<R>>,
|
|
539
|
+
toElementFn?: (rawElement: RM) => string,
|
|
540
|
+
thisArg?: any
|
|
541
|
+
): Trie<RM> {
|
|
542
|
+
const newTrie = new Trie<RM>([], { toElementFn, caseSensitive: this.caseSensitive });
|
|
528
543
|
let index = 0;
|
|
529
544
|
for (const word of this) {
|
|
530
545
|
newTrie.add(callback.call(thisArg, word, index, this));
|
|
@@ -545,7 +560,7 @@ export class Trie extends IterableElementBase<string, Trie> {
|
|
|
545
560
|
* The function `_getIterator` returns an iterable iterator that performs a depth-first search on a
|
|
546
561
|
* trie data structure and yields all the paths to the end nodes.
|
|
547
562
|
*/
|
|
548
|
-
protected*
|
|
563
|
+
protected *_getIterator(): IterableIterator<string> {
|
|
549
564
|
function* _dfs(node: TrieNode, path: string): IterableIterator<string> {
|
|
550
565
|
if (node.isEnd) {
|
|
551
566
|
yield path;
|
|
@@ -5,12 +5,11 @@ import type {
|
|
|
5
5
|
BinaryTreeNodeNested,
|
|
6
6
|
BinaryTreeOptions,
|
|
7
7
|
BTNCallback,
|
|
8
|
-
|
|
9
|
-
KeyOrNodeOrEntry
|
|
8
|
+
BTNKeyOrNodeOrEntry
|
|
10
9
|
} from '../types';
|
|
11
10
|
|
|
12
11
|
export interface IBinaryTree<
|
|
13
|
-
K
|
|
12
|
+
K = any,
|
|
14
13
|
V = any,
|
|
15
14
|
R = [K, V],
|
|
16
15
|
NODE extends BinaryTreeNode<K, V, NODE> = BinaryTreeNodeNested<K, V>,
|
|
@@ -20,9 +19,9 @@ export interface IBinaryTree<
|
|
|
20
19
|
|
|
21
20
|
createTree(options?: Partial<BinaryTreeOptions<K, V, R>>): TREE;
|
|
22
21
|
|
|
23
|
-
add(keyOrNodeOrEntryOrRawElement:
|
|
22
|
+
add(keyOrNodeOrEntryOrRawElement: BTNKeyOrNodeOrEntry<K, V, NODE>, value?: V, count?: number): boolean;
|
|
24
23
|
|
|
25
|
-
addMany(nodes: Iterable<
|
|
24
|
+
addMany(nodes: Iterable<BTNKeyOrNodeOrEntry<K, V, NODE>>, values?: Iterable<V | undefined>): boolean[];
|
|
26
25
|
|
|
27
26
|
delete<C extends BTNCallback<NODE>>(identifier: ReturnType<C> | null, callback: C): BinaryTreeDeleteResult<NODE>[];
|
|
28
27
|
}
|
package/src/types/common.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
export type CP = 1 | -1 | 0;
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Enum representing different loop types.
|
|
5
|
-
*
|
|
6
|
-
* - `iterative`: Indicates the iterative loop type (with loops that use iterations).
|
|
7
|
-
* - `recursive`: Indicates the recursive loop type (with loops that call themselves).
|
|
8
|
-
*/
|
|
9
3
|
export type IterationType = 'ITERATIVE' | 'RECURSIVE';
|
|
10
4
|
|
|
11
5
|
export type FamilyPosition = 'ROOT' | 'LEFT' | 'RIGHT' | 'ROOT_LEFT' | 'ROOT_RIGHT' | 'ISOLATED' | 'MAL_NODE';
|
|
@@ -16,8 +10,6 @@ export type DFSOrderPattern = 'PRE' | 'IN' | 'POST';
|
|
|
16
10
|
|
|
17
11
|
export type NodeDisplayLayout = [string[], number, number, number];
|
|
18
12
|
|
|
19
|
-
export type BTNCallback<N, D = any> = (node: N) => D;
|
|
20
|
-
|
|
21
13
|
export interface IterableWithSize<T> extends Iterable<T> {
|
|
22
14
|
size: number | ((...args: any[]) => number);
|
|
23
15
|
}
|
|
@@ -26,22 +18,8 @@ export interface IterableWithLength<T> extends Iterable<T> {
|
|
|
26
18
|
length: number | ((...args: any[]) => number);
|
|
27
19
|
}
|
|
28
20
|
|
|
29
|
-
export type
|
|
30
|
-
|
|
31
|
-
export type BinaryTreePrintOptions = { isShowUndefined?: boolean; isShowNull?: boolean; isShowRedBlackNIL?: boolean };
|
|
32
|
-
|
|
33
|
-
export type BTNEntry<K, V> = [K | null | undefined, V | undefined];
|
|
34
|
-
|
|
35
|
-
export type BTNKeyOrNode<K, N> = K | null | undefined | N;
|
|
21
|
+
export type OptValue<V> = V | undefined;
|
|
36
22
|
|
|
37
|
-
export type
|
|
38
|
-
|
|
39
|
-
export type BTNodePureKeyOrNode<K, N> = K | N;
|
|
40
|
-
|
|
41
|
-
export type BTNPureKeyOrNodeOrEntry<K, V, N> = [K, V | undefined] | BTNodePureKeyOrNode<K, N>;
|
|
42
|
-
|
|
43
|
-
export type BSTNKeyOrNode<K, N> = K | undefined | N;
|
|
44
|
-
|
|
45
|
-
export type BinaryTreeDeleteResult<N> = { deleted: N | null | undefined; needBalanced: N | null | undefined };
|
|
23
|
+
export type IterableWithSizeOrLength<T> = IterableWithSize<T> | IterableWithLength<T>;
|
|
46
24
|
|
|
47
25
|
export type CRUD = 'CREATED' | 'READ' | 'UPDATED' | 'DELETED';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IterableElementBase, IterableEntryBase } from '../../../data-structures';
|
|
2
2
|
|
|
3
3
|
export type EntryCallback<K, V, R> = (value: V, key: K, index: number, container: IterableEntryBase<K, V>) => R;
|
|
4
|
-
export type ElementCallback<
|
|
4
|
+
export type ElementCallback<E, R, RT, C> = (element: E, index: number, container: IterableElementBase<E, R, C>) => RT;
|
|
5
5
|
export type ReduceEntryCallback<K, V, R> = (
|
|
6
6
|
accumulator: R,
|
|
7
7
|
value: V,
|
|
@@ -9,9 +9,17 @@ export type ReduceEntryCallback<K, V, R> = (
|
|
|
9
9
|
index: number,
|
|
10
10
|
container: IterableEntryBase<K, V>
|
|
11
11
|
) => R;
|
|
12
|
-
export type ReduceElementCallback<
|
|
13
|
-
accumulator:
|
|
14
|
-
element:
|
|
12
|
+
export type ReduceElementCallback<E, R, RT, C> = (
|
|
13
|
+
accumulator: RT,
|
|
14
|
+
element: E,
|
|
15
15
|
index: number,
|
|
16
|
-
container: IterableElementBase<
|
|
17
|
-
) =>
|
|
16
|
+
container: IterableElementBase<E, R, C>
|
|
17
|
+
) => RT;
|
|
18
|
+
|
|
19
|
+
// export type IterableEntryBaseOptions<K, V, R> = {
|
|
20
|
+
// toEntryFn?: (rawElement: R) => BTNEntry<K, V>;
|
|
21
|
+
// };
|
|
22
|
+
|
|
23
|
+
export type IterableElementBaseOptions<E, R> = {
|
|
24
|
+
toElementFn?: (rawElement: R) => E;
|
|
25
|
+
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { AVLTreeMultiMap, AVLTreeMultiMapNode } from '../../../data-structures';
|
|
2
2
|
import type { AVLTreeOptions } from './avl-tree';
|
|
3
|
-
import { Comparable } from "../../utils";
|
|
4
3
|
|
|
5
|
-
export type AVLTreeMultiMapNodeNested<K
|
|
4
|
+
export type AVLTreeMultiMapNodeNested<K, V> = AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
6
5
|
|
|
7
|
-
export type AVLTreeMultiMapNested<K
|
|
6
|
+
export type AVLTreeMultiMapNested<K, V, R, NODE extends AVLTreeMultiMapNode<K, V, NODE>> = AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
8
7
|
|
|
9
8
|
export type AVLTreeMultiMapOptions<K, V, R> = AVLTreeOptions<K, V, R> & {}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { AVLTree, AVLTreeNode } from '../../../data-structures';
|
|
2
2
|
import { BSTOptions } from './bst';
|
|
3
|
-
import { Comparable } from "../../utils";
|
|
4
3
|
|
|
5
|
-
export type AVLTreeNodeNested<K
|
|
4
|
+
export type AVLTreeNodeNested<K, V> = AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
6
5
|
|
|
7
|
-
export type AVLTreeNested<K
|
|
6
|
+
export type AVLTreeNested<K, V, R, NODE extends AVLTreeNode<K, V, NODE>> = AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
8
7
|
|
|
9
8
|
export type AVLTreeOptions<K, V, R> = BSTOptions<K, V, R> & {};
|
|
@@ -1,12 +1,31 @@
|
|
|
1
1
|
import { BinaryTree, BinaryTreeNode } from '../../../data-structures';
|
|
2
|
-
import {
|
|
3
|
-
import { Comparable } from '../../utils';
|
|
2
|
+
import { IterationType, OptValue } from '../../common';
|
|
4
3
|
|
|
5
|
-
export type BinaryTreeNodeNested<K
|
|
4
|
+
export type BinaryTreeNodeNested<K, V> = BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
6
5
|
|
|
7
|
-
export type BinaryTreeNested<K
|
|
6
|
+
export type BinaryTreeNested<K, V, R, NODE extends BinaryTreeNode<K, V, NODE>> = BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
8
7
|
|
|
9
8
|
export type BinaryTreeOptions<K, V, R> = {
|
|
10
|
-
iterationType?: IterationType
|
|
9
|
+
iterationType?: IterationType;
|
|
11
10
|
toEntryFn?: (rawElement: R) => BTNEntry<K, V>;
|
|
12
11
|
}
|
|
12
|
+
|
|
13
|
+
export type BinaryTreePrintOptions = { isShowUndefined?: boolean; isShowNull?: boolean; isShowRedBlackNIL?: boolean };
|
|
14
|
+
|
|
15
|
+
export type OptBTNOrNull<NODE> = NODE | null | undefined;
|
|
16
|
+
|
|
17
|
+
export type OptBTNKeyOrNull<K> = K | null | undefined;
|
|
18
|
+
|
|
19
|
+
export type BTNEntry<K, V> = [OptBTNKeyOrNull<K>, OptValue<V>];
|
|
20
|
+
|
|
21
|
+
export type BTNKeyOrNode<K, NODE> = OptBTNKeyOrNull<K> | NODE;
|
|
22
|
+
|
|
23
|
+
export type BTNKeyOrNodeOrEntry<K, V, NODE> = BTNEntry<K, V> | BTNKeyOrNode<K, NODE>;
|
|
24
|
+
|
|
25
|
+
export type BTNPureKeyOrNode<K, NODE> = K | NODE;
|
|
26
|
+
|
|
27
|
+
export type BTNPureKeyOrNodeOrEntry<K, V, NODE> = [K, OptValue<V>] | BTNPureKeyOrNode<K, NODE>;
|
|
28
|
+
|
|
29
|
+
export type BinaryTreeDeleteResult<NODE> = { deleted: OptBTNOrNull<NODE>; needBalanced: OptBTNOrNull<NODE> };
|
|
30
|
+
|
|
31
|
+
export type BTNCallback<NODE, D = any> = (node: NODE) => D;
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { BST, BSTNode } from '../../../data-structures';
|
|
2
2
|
import type { BinaryTreeOptions } from './binary-tree';
|
|
3
3
|
import { Comparator } from '../../common';
|
|
4
|
-
import { Comparable } from '../../utils';
|
|
5
4
|
|
|
6
|
-
export type BSTNodeNested<K
|
|
5
|
+
export type BSTNodeNested<K, V> = BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
7
6
|
|
|
8
|
-
export type BSTNested<K
|
|
7
|
+
export type BSTNested<K, V, R, NODE extends BSTNode<K, V, NODE>> = BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
9
8
|
|
|
10
9
|
export type BSTOptions<K, V, R> = BinaryTreeOptions<K, V, R> & {
|
|
11
10
|
comparator?: Comparator<K>
|
|
12
11
|
}
|
|
12
|
+
|
|
13
|
+
export type OptBSTNKey<K> = K | undefined;
|
|
14
|
+
|
|
15
|
+
export type OptBSTN<NODE> = NODE | undefined;
|
|
16
|
+
|
|
17
|
+
export type BSTNKeyOrNode<K, NODE> = OptBSTNKey<K> | NODE;
|
|
18
|
+
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { RedBlackTree, RedBlackTreeNode } from '../../../data-structures';
|
|
2
2
|
import type { BSTOptions } from "./bst";
|
|
3
|
-
import { Comparable } from "../../utils";
|
|
4
3
|
|
|
5
4
|
export type RBTNColor = 'RED' | 'BLACK';
|
|
6
5
|
|
|
7
|
-
export type RedBlackTreeNodeNested<K
|
|
6
|
+
export type RedBlackTreeNodeNested<K, V> = RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, RedBlackTreeNode<K, V, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
8
7
|
|
|
9
|
-
export type RedBlackTreeNested<K
|
|
8
|
+
export type RedBlackTreeNested<K, V, R, NODE extends RedBlackTreeNode<K, V, NODE>> = RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
10
9
|
|
|
11
10
|
export type RBTreeOptions<K, V, R> = BSTOptions<K, V, R> & {};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { TreeMultiMap, TreeMultiMapNode } from '../../../data-structures';
|
|
2
2
|
import type { RBTreeOptions } from './rb-tree';
|
|
3
|
-
import { Comparable } from '../../utils';
|
|
4
3
|
|
|
5
|
-
export type TreeMultiMapNodeNested<K
|
|
4
|
+
export type TreeMultiMapNodeNested<K, V> = TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
6
5
|
|
|
7
|
-
export type TreeMultiMapNested<K
|
|
6
|
+
export type TreeMultiMapNested<K, V, R, NODE extends TreeMultiMapNode<K, V, NODE>> = TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
8
7
|
|
|
9
8
|
export type TreeMultiMapOptions<K, V, R> = RBTreeOptions<K, V, R> & {}
|
|
@@ -2,12 +2,12 @@ export type VertexKey = string | number;
|
|
|
2
2
|
|
|
3
3
|
export type DijkstraResult<V> =
|
|
4
4
|
| {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
5
|
+
distMap: Map<V, number>;
|
|
6
|
+
distPaths?: Map<V, V[]>;
|
|
7
|
+
preMap: Map<V, V | undefined>;
|
|
8
|
+
seen: Set<V>;
|
|
9
|
+
paths: V[][];
|
|
10
|
+
minDist: number;
|
|
11
|
+
minPath: V[];
|
|
12
|
+
}
|
|
13
13
|
| undefined;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { Comparator } from '../../common';
|
|
2
|
+
import { IterableElementBaseOptions } from '../base';
|
|
2
3
|
|
|
3
|
-
export type HeapOptions<
|
|
4
|
+
export type HeapOptions<E, R> = IterableElementBaseOptions<E, R> & {
|
|
5
|
+
comparator?: Comparator<E>;
|
|
6
|
+
};
|
package/src/types/utils/utils.ts
CHANGED
|
@@ -13,9 +13,9 @@ export type Comparable =
|
|
|
13
13
|
| bigint
|
|
14
14
|
| boolean
|
|
15
15
|
| ({ [key in string]: any } & {
|
|
16
|
-
|
|
17
|
-
})
|
|
16
|
+
valueOf(): Comparable;
|
|
17
|
+
})
|
|
18
18
|
| ({ [key in string]: any } & {
|
|
19
|
-
|
|
20
|
-
})
|
|
19
|
+
toString(): Comparable;
|
|
20
|
+
})
|
|
21
21
|
| (() => Comparable);
|