min-heap-typed 1.49.0 → 1.49.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/iterable-base.d.ts +11 -0
- package/dist/data-structures/base/iterable-base.js +21 -0
- package/dist/data-structures/binary-tree/avl-tree.d.ts +10 -12
- package/dist/data-structures/binary-tree/avl-tree.js +3 -4
- package/dist/data-structures/binary-tree/binary-tree.d.ts +58 -58
- package/dist/data-structures/binary-tree/binary-tree.js +6 -6
- package/dist/data-structures/binary-tree/bst.d.ts +15 -15
- package/dist/data-structures/binary-tree/bst.js +3 -3
- package/dist/data-structures/binary-tree/rb-tree.d.ts +11 -11
- package/dist/data-structures/binary-tree/rb-tree.js +5 -6
- package/dist/data-structures/binary-tree/tree-multimap.d.ts +14 -14
- package/dist/data-structures/binary-tree/tree-multimap.js +3 -3
- package/dist/data-structures/graph/abstract-graph.d.ts +9 -3
- package/dist/data-structures/graph/abstract-graph.js +27 -31
- package/dist/data-structures/graph/directed-graph.d.ts +8 -1
- package/dist/data-structures/graph/directed-graph.js +1 -8
- package/dist/data-structures/graph/map-graph.d.ts +1 -1
- package/dist/data-structures/graph/undirected-graph.d.ts +8 -1
- package/dist/data-structures/graph/undirected-graph.js +1 -8
- package/dist/data-structures/hash/hash-map.d.ts +22 -10
- package/dist/data-structures/hash/hash-map.js +28 -16
- package/dist/data-structures/hash/hash-table.d.ts +2 -2
- package/dist/data-structures/heap/heap.d.ts +20 -38
- package/dist/data-structures/heap/heap.js +22 -42
- package/dist/data-structures/heap/max-heap.d.ts +11 -1
- package/dist/data-structures/heap/max-heap.js +10 -7
- package/dist/data-structures/heap/min-heap.d.ts +11 -1
- package/dist/data-structures/heap/min-heap.js +10 -7
- package/dist/data-structures/linked-list/doubly-linked-list.d.ts +95 -95
- package/dist/data-structures/linked-list/doubly-linked-list.js +132 -136
- package/dist/data-structures/linked-list/singly-linked-list.d.ts +18 -23
- package/dist/data-structures/linked-list/singly-linked-list.js +42 -49
- package/dist/data-structures/linked-list/skip-linked-list.d.ts +2 -2
- package/dist/data-structures/linked-list/skip-linked-list.js +2 -2
- package/dist/data-structures/priority-queue/max-priority-queue.d.ts +1 -1
- package/dist/data-structures/priority-queue/max-priority-queue.js +0 -7
- package/dist/data-structures/priority-queue/min-priority-queue.d.ts +1 -1
- package/dist/data-structures/priority-queue/min-priority-queue.js +0 -7
- package/dist/data-structures/priority-queue/priority-queue.d.ts +9 -1
- package/dist/data-structures/priority-queue/priority-queue.js +8 -7
- package/dist/data-structures/queue/deque.d.ts +76 -80
- package/dist/data-structures/queue/deque.js +106 -122
- package/dist/data-structures/queue/queue.d.ts +30 -16
- package/dist/data-structures/queue/queue.js +31 -24
- package/dist/data-structures/stack/stack.d.ts +17 -8
- package/dist/data-structures/stack/stack.js +9 -9
- package/dist/data-structures/trie/trie.d.ts +14 -5
- package/dist/data-structures/trie/trie.js +13 -13
- package/dist/interfaces/binary-tree.d.ts +4 -4
- package/dist/types/common.d.ts +32 -8
- package/dist/types/common.js +22 -1
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +1 -24
- package/dist/types/data-structures/binary-tree/binary-tree.js +0 -22
- package/dist/types/data-structures/binary-tree/rb-tree.d.ts +1 -1
- package/dist/types/data-structures/binary-tree/tree-multimap.d.ts +1 -1
- package/package.json +2 -2
- package/src/data-structures/base/iterable-base.ts +24 -0
- package/src/data-structures/binary-tree/avl-tree.ts +14 -14
- package/src/data-structures/binary-tree/binary-tree.ts +74 -77
- package/src/data-structures/binary-tree/bst.ts +18 -17
- package/src/data-structures/binary-tree/rb-tree.ts +17 -18
- package/src/data-structures/binary-tree/tree-multimap.ts +22 -20
- package/src/data-structures/graph/abstract-graph.ts +35 -25
- package/src/data-structures/graph/directed-graph.ts +2 -2
- package/src/data-structures/graph/map-graph.ts +1 -1
- package/src/data-structures/graph/undirected-graph.ts +2 -2
- package/src/data-structures/hash/hash-map.ts +40 -24
- package/src/data-structures/hash/hash-table.ts +3 -3
- package/src/data-structures/heap/heap.ts +33 -60
- package/src/data-structures/heap/max-heap.ts +11 -2
- package/src/data-structures/heap/min-heap.ts +11 -2
- package/src/data-structures/linked-list/doubly-linked-list.ts +147 -145
- package/src/data-structures/linked-list/singly-linked-list.ts +52 -52
- package/src/data-structures/linked-list/skip-linked-list.ts +2 -2
- package/src/data-structures/priority-queue/max-priority-queue.ts +1 -1
- package/src/data-structures/priority-queue/min-priority-queue.ts +1 -1
- package/src/data-structures/priority-queue/priority-queue.ts +9 -2
- package/src/data-structures/queue/deque.ts +129 -144
- package/src/data-structures/queue/queue.ts +37 -26
- package/src/data-structures/stack/stack.ts +20 -14
- package/src/data-structures/trie/trie.ts +18 -13
- package/src/interfaces/binary-tree.ts +5 -5
- package/src/types/common.ts +37 -12
- package/src/types/data-structures/binary-tree/avl-tree.ts +0 -1
- package/src/types/data-structures/binary-tree/binary-tree.ts +1 -26
- package/src/types/data-structures/binary-tree/bst.ts +0 -1
- package/src/types/data-structures/binary-tree/rb-tree.ts +1 -1
- package/src/types/data-structures/binary-tree/tree-multimap.ts +1 -1
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* data-structure-typed
|
|
3
|
+
*
|
|
4
|
+
* @author Tyler Zeng
|
|
5
|
+
* @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
|
|
6
|
+
* @license MIT License
|
|
7
|
+
*/
|
|
8
|
+
import type { ElementCallback } from '../../types';
|
|
9
|
+
import { IterableElementBase } from '../base';
|
|
3
10
|
|
|
4
11
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
12
|
+
* 1. Last In, First Out (LIFO): The core characteristic of a stack is its last in, first out nature, meaning the last element added to the stack will be the first to be removed.
|
|
13
|
+
* 2. Uses: Stacks are commonly used for managing a series of tasks or elements that need to be processed in a last in, first out manner. They are widely used in various scenarios, such as in function calls in programming languages, evaluation of arithmetic expressions, and backtracking algorithms.
|
|
14
|
+
* 3. Performance: Stack operations are typically O(1) in time complexity, meaning that regardless of the stack's size, adding, removing, and viewing the top element are very fast operations.
|
|
15
|
+
* 4. Function Calls: In most modern programming languages, the records of function calls are managed through a stack. When a function is called, its record (including parameters, local variables, and return address) is 'pushed' into the stack. When the function returns, its record is 'popped' from the stack.
|
|
16
|
+
* 5. Expression Evaluation: Used for the evaluation of arithmetic or logical expressions, especially when dealing with parenthesis matching and operator precedence.
|
|
17
|
+
* 6. Backtracking Algorithms: In problems where multiple branches need to be explored but only one branch can be explored at a time, stacks can be used to save the state at each branching point.
|
|
8
18
|
*/
|
|
9
19
|
export class Stack<E = any> extends IterableElementBase<E> {
|
|
10
20
|
/**
|
|
@@ -94,9 +104,9 @@ export class Stack<E = any> extends IterableElementBase<E> {
|
|
|
94
104
|
* @param {E} element - The parameter "element" is of type E, which means it can be any data type.
|
|
95
105
|
* @returns The `push` method is returning the updated `Stack<E>` object.
|
|
96
106
|
*/
|
|
97
|
-
push(element: E):
|
|
107
|
+
push(element: E): boolean {
|
|
98
108
|
this.elements.push(element);
|
|
99
|
-
return
|
|
109
|
+
return true;
|
|
100
110
|
}
|
|
101
111
|
|
|
102
112
|
/**
|
|
@@ -113,9 +123,9 @@ export class Stack<E = any> extends IterableElementBase<E> {
|
|
|
113
123
|
* array is empty, it returns `undefined`.
|
|
114
124
|
*/
|
|
115
125
|
pop(): E | undefined {
|
|
116
|
-
if (this.isEmpty()) return
|
|
126
|
+
if (this.isEmpty()) return;
|
|
117
127
|
|
|
118
|
-
return this.elements.pop()
|
|
128
|
+
return this.elements.pop();
|
|
119
129
|
}
|
|
120
130
|
|
|
121
131
|
/**
|
|
@@ -218,15 +228,11 @@ export class Stack<E = any> extends IterableElementBase<E> {
|
|
|
218
228
|
return newStack;
|
|
219
229
|
}
|
|
220
230
|
|
|
221
|
-
print(): void {
|
|
222
|
-
console.log([...this]);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
231
|
/**
|
|
226
232
|
* Custom iterator for the Stack class.
|
|
227
233
|
* @returns An iterator object.
|
|
228
234
|
*/
|
|
229
|
-
protected* _getIterator() {
|
|
235
|
+
protected* _getIterator(): IterableIterator<E> {
|
|
230
236
|
for (let i = 0; i < this.elements.length; i++) {
|
|
231
237
|
yield this.elements[i];
|
|
232
238
|
}
|
|
@@ -5,9 +5,8 @@
|
|
|
5
5
|
* @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
import { IterableElementBase } from
|
|
10
|
-
import { ElementCallback } from "../../types";
|
|
8
|
+
import type { ElementCallback } from '../../types';
|
|
9
|
+
import { IterableElementBase } from '../base';
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* TrieNode represents a node in the Trie data structure. It holds a character key, a map of children nodes,
|
|
@@ -26,7 +25,17 @@ export class TrieNode {
|
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
/**
|
|
29
|
-
* Trie represents a
|
|
28
|
+
* 1. Node Structure: Each node in a Trie represents a string (or a part of a string). The root node typically represents an empty string.
|
|
29
|
+
* 2. Child Node Relationship: Each node's children represent the strings that can be formed by adding one character to the string at the current node. For example, if a node represents the string 'ca', one of its children might represent 'cat'.
|
|
30
|
+
* 3. Fast Retrieval: Trie allows retrieval in O(m) time complexity, where m is the length of the string to be searched.
|
|
31
|
+
* 4. Space Efficiency: Trie can store a large number of strings very space-efficiently, especially when these strings share common prefixes.
|
|
32
|
+
* 5. Autocomplete and Prediction: Trie can be used for implementing autocomplete and word prediction features, as it can quickly find all strings with a common prefix.
|
|
33
|
+
* 6. Sorting: Trie can be used to sort a set of strings in alphabetical order.
|
|
34
|
+
* 7. String Retrieval: For example, searching for a specific string in a large set of strings.
|
|
35
|
+
* 8. Autocomplete: Providing recommended words or phrases as a user types.
|
|
36
|
+
* 9. Spell Check: Checking the spelling of words.
|
|
37
|
+
* 10. IP Routing: Used in certain types of IP routing algorithms.
|
|
38
|
+
* 11. Text Word Frequency Count: Counting and storing the frequency of words in a large amount of text data."
|
|
30
39
|
*/
|
|
31
40
|
export class Trie extends IterableElementBase<string> {
|
|
32
41
|
constructor(words?: string[], caseSensitive = true) {
|
|
@@ -129,7 +138,7 @@ export class Trie extends IterableElementBase<string> {
|
|
|
129
138
|
* @param{string} word - The word to delete.
|
|
130
139
|
* @returns {boolean} True if the word was successfully removed.
|
|
131
140
|
*/
|
|
132
|
-
delete(word: string) {
|
|
141
|
+
delete(word: string): boolean {
|
|
133
142
|
word = this._caseProcess(word);
|
|
134
143
|
let isDeleted = false;
|
|
135
144
|
const dfs = (cur: TrieNode, i: number): boolean => {
|
|
@@ -175,7 +184,7 @@ export class Trie extends IterableElementBase<string> {
|
|
|
175
184
|
* Space Complexity: O(1) - Constant space.
|
|
176
185
|
*
|
|
177
186
|
*/
|
|
178
|
-
getHeight() {
|
|
187
|
+
getHeight(): number {
|
|
179
188
|
const beginRoot = this.root;
|
|
180
189
|
let maxDepth = 0;
|
|
181
190
|
if (beginRoot) {
|
|
@@ -362,12 +371,12 @@ export class Trie extends IterableElementBase<string> {
|
|
|
362
371
|
* specific object as the context for the `predicate` function. If `thisArg` is provided, it will be
|
|
363
372
|
* @returns The `filter` method is returning an array of strings (`string[]`).
|
|
364
373
|
*/
|
|
365
|
-
filter(predicate: ElementCallback<string, boolean>, thisArg?: any):
|
|
366
|
-
const results:
|
|
374
|
+
filter(predicate: ElementCallback<string, boolean>, thisArg?: any): Trie {
|
|
375
|
+
const results: Trie = new Trie();
|
|
367
376
|
let index = 0;
|
|
368
377
|
for (const word of this) {
|
|
369
378
|
if (predicate.call(thisArg, word, index, this)) {
|
|
370
|
-
results.
|
|
379
|
+
results.add(word);
|
|
371
380
|
}
|
|
372
381
|
index++;
|
|
373
382
|
}
|
|
@@ -402,10 +411,6 @@ export class Trie extends IterableElementBase<string> {
|
|
|
402
411
|
return newTrie;
|
|
403
412
|
}
|
|
404
413
|
|
|
405
|
-
print() {
|
|
406
|
-
console.log([...this]);
|
|
407
|
-
}
|
|
408
|
-
|
|
409
414
|
protected* _getIterator(): IterableIterator<string> {
|
|
410
415
|
function* _dfs(node: TrieNode, path: string): IterableIterator<string> {
|
|
411
416
|
if (node.isEnd) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { BinaryTree, BinaryTreeNode } from '../data-structures';
|
|
2
2
|
import {
|
|
3
|
+
BinaryTreeDeleteResult,
|
|
3
4
|
BinaryTreeNested,
|
|
4
5
|
BinaryTreeNodeNested,
|
|
5
6
|
BinaryTreeOptions,
|
|
6
|
-
BiTreeDeleteResult,
|
|
7
7
|
BTNCallback,
|
|
8
|
-
|
|
8
|
+
BTNExemplar,
|
|
9
9
|
} from '../types';
|
|
10
10
|
|
|
11
11
|
export interface IBinaryTree<K = number, V = any, N extends BinaryTreeNode<K, V, N> = BinaryTreeNodeNested<K, V>, TREE extends BinaryTree<K, V, N, TREE> = BinaryTreeNested<K, V, N>> {
|
|
@@ -13,9 +13,9 @@ export interface IBinaryTree<K = number, V = any, N extends BinaryTreeNode<K, V,
|
|
|
13
13
|
|
|
14
14
|
createTree(options?: Partial<BinaryTreeOptions<K>>): TREE;
|
|
15
15
|
|
|
16
|
-
add(keyOrNodeOrEntry:
|
|
16
|
+
add(keyOrNodeOrEntry: BTNExemplar<K, V, N>, value?: V, count?: number): N | null | undefined;
|
|
17
17
|
|
|
18
|
-
addMany(nodes: Iterable<
|
|
18
|
+
addMany(nodes: Iterable<BTNExemplar<K, V, N>>, values?: Iterable<V | undefined>): (N | null | undefined)[];
|
|
19
19
|
|
|
20
|
-
delete<C extends BTNCallback<N>>(identifier: ReturnType<C> | null, callback: C):
|
|
20
|
+
delete<C extends BTNCallback<N>>(identifier: ReturnType<C> | null, callback: C): BinaryTreeDeleteResult<N>[];
|
|
21
21
|
}
|
package/src/types/common.ts
CHANGED
|
@@ -1,20 +1,43 @@
|
|
|
1
|
-
export type Comparator<K> = (a: K, b: K) => number;
|
|
2
|
-
|
|
3
1
|
export enum BSTVariant {
|
|
4
2
|
MIN = 'MIN',
|
|
5
3
|
MAX = 'MAX',
|
|
6
4
|
}
|
|
7
5
|
|
|
8
|
-
export type DFSOrderPattern = 'pre' | 'in' | 'post';
|
|
9
|
-
|
|
10
|
-
export type BTNCallback<N, D = any> = (node: N) => D;
|
|
11
|
-
|
|
12
6
|
export enum CP {
|
|
13
7
|
lt = 'lt',
|
|
14
8
|
eq = 'eq',
|
|
15
9
|
gt = 'gt'
|
|
16
10
|
}
|
|
17
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Enum representing different loop types.
|
|
14
|
+
*
|
|
15
|
+
* - `iterative`: Indicates the iterative loop type (with loops that use iterations).
|
|
16
|
+
* - `recursive`: Indicates the recursive loop type (with loops that call themselves).
|
|
17
|
+
*/
|
|
18
|
+
export enum IterationType {
|
|
19
|
+
ITERATIVE = 'ITERATIVE',
|
|
20
|
+
RECURSIVE = 'RECURSIVE'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export enum FamilyPosition {
|
|
24
|
+
ROOT = 'ROOT',
|
|
25
|
+
LEFT = 'LEFT',
|
|
26
|
+
RIGHT = 'RIGHT',
|
|
27
|
+
ROOT_LEFT = 'ROOT_LEFT',
|
|
28
|
+
ROOT_RIGHT = 'ROOT_RIGHT',
|
|
29
|
+
ISOLATED = 'ISOLATED',
|
|
30
|
+
MAL_NODE = 'MAL_NODE'
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type Comparator<K> = (a: K, b: K) => number;
|
|
34
|
+
|
|
35
|
+
export type DFSOrderPattern = 'pre' | 'in' | 'post';
|
|
36
|
+
|
|
37
|
+
export type NodeDisplayLayout = [string[], number, number, number];
|
|
38
|
+
|
|
39
|
+
export type BTNCallback<N, D = any> = (node: N) => D;
|
|
40
|
+
|
|
18
41
|
export interface IterableWithSize<T> extends Iterable<T> {
|
|
19
42
|
size: number | ((...args: any[]) => number);
|
|
20
43
|
}
|
|
@@ -27,14 +50,16 @@ export type IterableWithSizeOrLength<T> = IterableWithSize<T> | IterableWithLeng
|
|
|
27
50
|
|
|
28
51
|
export type BinaryTreePrintOptions = { isShowUndefined?: boolean, isShowNull?: boolean, isShowRedBlackNIL?: boolean }
|
|
29
52
|
|
|
30
|
-
export type
|
|
31
|
-
|
|
32
|
-
export type BTNodeKeyOrNode<K, N> = K | null | undefined | N;
|
|
53
|
+
export type BTNEntry<K, V> = [K | null | undefined, V | undefined];
|
|
33
54
|
|
|
34
|
-
export type
|
|
55
|
+
export type BTNKeyOrNode<K, N> = K | null | undefined | N;
|
|
35
56
|
|
|
36
|
-
export type
|
|
57
|
+
export type BTNExemplar<K, V, N> = BTNEntry<K, V> | BTNKeyOrNode<K, N>
|
|
37
58
|
|
|
38
59
|
export type BTNodePureKeyOrNode<K, N> = K | N;
|
|
39
60
|
|
|
40
|
-
export type
|
|
61
|
+
export type BTNodePureExemplar<K, V, N> = [K, V | undefined] | BTNodePureKeyOrNode<K, N>;
|
|
62
|
+
|
|
63
|
+
export type BSTNKeyOrNode<K, N> = K | undefined | N;
|
|
64
|
+
|
|
65
|
+
export type BinaryTreeDeleteResult<N> = { deleted: N | null | undefined; needBalanced: N | null | undefined };
|
|
@@ -5,5 +5,4 @@ export type AVLTreeNodeNested<K, V> = AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTre
|
|
|
5
5
|
|
|
6
6
|
export type AVLTreeNested<K, V, N extends AVLTreeNode<K, V, N>> = AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, AVLTree<K, V, N, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
7
7
|
|
|
8
|
-
|
|
9
8
|
export type AVLTreeOptions<K> = BSTOptions<K> & {};
|
|
@@ -1,28 +1,5 @@
|
|
|
1
1
|
import { BinaryTree, BinaryTreeNode } from '../../../data-structures';
|
|
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
|
-
|
|
10
|
-
export enum IterationType {
|
|
11
|
-
ITERATIVE = 'ITERATIVE',
|
|
12
|
-
RECURSIVE = 'RECURSIVE'
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export enum FamilyPosition {
|
|
16
|
-
ROOT = 'ROOT',
|
|
17
|
-
LEFT = 'LEFT',
|
|
18
|
-
RIGHT = 'RIGHT',
|
|
19
|
-
ROOT_LEFT = 'ROOT_LEFT',
|
|
20
|
-
ROOT_RIGHT = 'ROOT_RIGHT',
|
|
21
|
-
ISOLATED = 'ISOLATED',
|
|
22
|
-
MAL_NODE = 'MAL_NODE'
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export type BiTreeDeleteResult<N> = { deleted: N | null | undefined; needBalanced: N | null | undefined };
|
|
2
|
+
import { IterationType } from "../../common";
|
|
26
3
|
|
|
27
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>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
28
5
|
|
|
@@ -32,5 +9,3 @@ export type BinaryTreeOptions<K> = {
|
|
|
32
9
|
iterationType: IterationType,
|
|
33
10
|
extractor: (key: K) => number
|
|
34
11
|
}
|
|
35
|
-
|
|
36
|
-
export type NodeDisplayLayout = [string[], number, number, number];
|
|
@@ -2,7 +2,6 @@ import { BST, BSTNode } from '../../../data-structures';
|
|
|
2
2
|
import type { BinaryTreeOptions } from './binary-tree';
|
|
3
3
|
import { BSTVariant } from "../../common";
|
|
4
4
|
|
|
5
|
-
// prettier-ignore
|
|
6
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
7
|
export type BSTNested<K, V, N extends BSTNode<K, V, N>> = BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TreeMultimap, TreeMultimapNode } from '../../../data-structures';
|
|
2
|
-
import { AVLTreeOptions } from './avl-tree';
|
|
2
|
+
import type { AVLTreeOptions } from './avl-tree';
|
|
3
3
|
|
|
4
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>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
5
5
|
|