priority-queue-typed 1.53.9 → 1.54.1
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/binary-tree/avl-tree-counter.d.ts +213 -0
- package/dist/data-structures/binary-tree/avl-tree-counter.js +407 -0
- package/dist/data-structures/binary-tree/avl-tree-multi-map.d.ts +71 -189
- package/dist/data-structures/binary-tree/avl-tree-multi-map.js +133 -357
- package/dist/data-structures/binary-tree/avl-tree.d.ts +108 -78
- package/dist/data-structures/binary-tree/avl-tree.js +126 -79
- package/dist/data-structures/binary-tree/binary-indexed-tree.d.ts +3 -0
- package/dist/data-structures/binary-tree/binary-indexed-tree.js +3 -0
- package/dist/data-structures/binary-tree/binary-tree.d.ts +243 -190
- package/dist/data-structures/binary-tree/binary-tree.js +273 -229
- package/dist/data-structures/binary-tree/bst.d.ts +141 -122
- package/dist/data-structures/binary-tree/bst.js +170 -134
- package/dist/data-structures/binary-tree/index.d.ts +2 -0
- package/dist/data-structures/binary-tree/index.js +2 -0
- package/dist/data-structures/binary-tree/red-black-tree.d.ts +84 -80
- package/dist/data-structures/binary-tree/red-black-tree.js +101 -79
- package/dist/data-structures/binary-tree/tree-counter.d.ts +212 -0
- package/dist/data-structures/binary-tree/tree-counter.js +444 -0
- package/dist/data-structures/binary-tree/tree-multi-map.d.ts +78 -186
- package/dist/data-structures/binary-tree/tree-multi-map.js +140 -388
- package/dist/data-structures/graph/directed-graph.d.ts +3 -0
- package/dist/data-structures/graph/directed-graph.js +3 -0
- package/dist/data-structures/graph/map-graph.d.ts +3 -0
- package/dist/data-structures/graph/map-graph.js +3 -0
- package/dist/data-structures/graph/undirected-graph.d.ts +3 -0
- package/dist/data-structures/graph/undirected-graph.js +3 -0
- package/dist/data-structures/linked-list/singly-linked-list.d.ts +3 -0
- package/dist/data-structures/linked-list/singly-linked-list.js +3 -0
- package/dist/data-structures/linked-list/skip-linked-list.d.ts +3 -0
- package/dist/data-structures/linked-list/skip-linked-list.js +3 -0
- package/dist/data-structures/matrix/matrix.d.ts +3 -0
- package/dist/data-structures/matrix/matrix.js +3 -0
- package/dist/data-structures/matrix/navigator.d.ts +3 -0
- package/dist/data-structures/matrix/navigator.js +3 -0
- package/dist/data-structures/priority-queue/max-priority-queue.d.ts +3 -0
- package/dist/data-structures/priority-queue/max-priority-queue.js +3 -0
- package/dist/data-structures/priority-queue/min-priority-queue.d.ts +3 -0
- package/dist/data-structures/priority-queue/min-priority-queue.js +3 -0
- package/dist/data-structures/trie/trie.d.ts +0 -4
- package/dist/data-structures/trie/trie.js +0 -4
- package/dist/interfaces/binary-tree.d.ts +7 -6
- package/dist/types/data-structures/binary-tree/avl-tree-counter.d.ts +2 -0
- package/dist/types/data-structures/binary-tree/avl-tree-counter.js +2 -0
- package/dist/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +1 -3
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +0 -2
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +0 -2
- package/dist/types/data-structures/binary-tree/bst.d.ts +3 -2
- package/dist/types/data-structures/binary-tree/index.d.ts +2 -0
- package/dist/types/data-structures/binary-tree/index.js +2 -0
- package/dist/types/data-structures/binary-tree/rb-tree.d.ts +1 -3
- package/dist/types/data-structures/binary-tree/tree-counter.d.ts +2 -0
- package/dist/types/data-structures/binary-tree/tree-counter.js +2 -0
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +1 -3
- package/package.json +2 -2
- package/src/data-structures/binary-tree/avl-tree-counter.ts +463 -0
- package/src/data-structures/binary-tree/avl-tree-multi-map.ts +148 -394
- package/src/data-structures/binary-tree/avl-tree.ts +152 -112
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +3 -0
- package/src/data-structures/binary-tree/binary-tree.ts +446 -379
- package/src/data-structures/binary-tree/bst.ts +224 -201
- package/src/data-structures/binary-tree/index.ts +2 -0
- package/src/data-structures/binary-tree/red-black-tree.ts +138 -114
- package/src/data-structures/binary-tree/tree-counter.ts +504 -0
- package/src/data-structures/binary-tree/tree-multi-map.ts +156 -428
- package/src/data-structures/graph/directed-graph.ts +3 -0
- package/src/data-structures/graph/map-graph.ts +3 -0
- package/src/data-structures/graph/undirected-graph.ts +3 -0
- package/src/data-structures/linked-list/singly-linked-list.ts +3 -0
- package/src/data-structures/linked-list/skip-linked-list.ts +3 -0
- package/src/data-structures/matrix/matrix.ts +3 -0
- package/src/data-structures/matrix/navigator.ts +3 -0
- package/src/data-structures/priority-queue/max-priority-queue.ts +3 -0
- package/src/data-structures/priority-queue/min-priority-queue.ts +3 -0
- package/src/data-structures/trie/trie.ts +0 -4
- package/src/interfaces/binary-tree.ts +10 -11
- package/src/types/data-structures/binary-tree/avl-tree-counter.ts +3 -0
- package/src/types/data-structures/binary-tree/avl-tree-multi-map.ts +1 -4
- package/src/types/data-structures/binary-tree/avl-tree.ts +0 -3
- package/src/types/data-structures/binary-tree/binary-tree.ts +0 -5
- package/src/types/data-structures/binary-tree/bst.ts +5 -3
- package/src/types/data-structures/binary-tree/index.ts +2 -0
- package/src/types/data-structures/binary-tree/rb-tree.ts +1 -4
- package/src/types/data-structures/binary-tree/tree-counter.ts +3 -0
- package/src/types/data-structures/binary-tree/tree-multi-map.ts +1 -4
|
@@ -1,30 +1,25 @@
|
|
|
1
|
-
import type { BinaryTreeDeleteResult, BTNRep, CRUD, EntryCallback, RBTNColor, RedBlackTreeOptions
|
|
1
|
+
import type { BinaryTreeDeleteResult, BTNRep, CRUD, EntryCallback, OptNodeOrNull, RBTNColor, RedBlackTreeOptions } from '../../types';
|
|
2
2
|
import { BST, BSTNode } from './bst';
|
|
3
3
|
import { IBinaryTree } from '../../interfaces';
|
|
4
|
-
export declare class RedBlackTreeNode<K = any, V = any
|
|
4
|
+
export declare class RedBlackTreeNode<K = any, V = any> extends BSTNode<K, V> {
|
|
5
5
|
/**
|
|
6
|
-
* The constructor
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* Tree Node. It is an optional parameter with a default value of `'BLACK'`.
|
|
6
|
+
* The constructor initializes a node with a key, value, and color for a Red-Black Tree.
|
|
7
|
+
* @param {K} key - The `key` parameter is a key of type `K` that is used to identify the node in a
|
|
8
|
+
* Red-Black Tree data structure.
|
|
9
|
+
* @param {V} [value] - The `value` parameter in the constructor is an optional parameter of type
|
|
10
|
+
* `V`. It represents the value associated with the key in the data structure being constructed.
|
|
11
|
+
* @param {RBTNColor} [color=BLACK] - The `color` parameter in the constructor is used to specify the
|
|
12
|
+
* color of the node in a Red-Black Tree. It has a default value of 'BLACK' if not provided
|
|
13
|
+
* explicitly.
|
|
15
14
|
*/
|
|
16
15
|
constructor(key: K, value?: V, color?: RBTNColor);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
get
|
|
23
|
-
|
|
24
|
-
* The function sets the color property to the specified value.
|
|
25
|
-
* @param {RBTNColor} value - The value parameter is of type RBTNColor.
|
|
26
|
-
*/
|
|
27
|
-
set color(value: RBTNColor);
|
|
16
|
+
parent?: RedBlackTreeNode<K, V>;
|
|
17
|
+
_left?: OptNodeOrNull<RedBlackTreeNode<K, V>>;
|
|
18
|
+
get left(): OptNodeOrNull<RedBlackTreeNode<K, V>>;
|
|
19
|
+
set left(v: OptNodeOrNull<RedBlackTreeNode<K, V>>);
|
|
20
|
+
_right?: OptNodeOrNull<RedBlackTreeNode<K, V>>;
|
|
21
|
+
get right(): OptNodeOrNull<RedBlackTreeNode<K, V>>;
|
|
22
|
+
set right(v: OptNodeOrNull<RedBlackTreeNode<K, V>>);
|
|
28
23
|
}
|
|
29
24
|
/**
|
|
30
25
|
* 1. Efficient self-balancing, but not completely balanced. Compared with AVLTree, the addition and deletion efficiency is high but the query efficiency is slightly lower.
|
|
@@ -79,25 +74,25 @@ export declare class RedBlackTreeNode<K = any, V = any, NODE extends RedBlackTre
|
|
|
79
74
|
* );
|
|
80
75
|
* console.log(stocksInRange); // ['GOOGL', 'MSFT', 'META']
|
|
81
76
|
*/
|
|
82
|
-
export declare class RedBlackTree<K = any, V = any, R = object,
|
|
77
|
+
export declare class RedBlackTree<K = any, V = any, R = object, MK = any, MV = any, MR = object> extends BST<K, V, R, MK, MV, MR> implements IBinaryTree<K, V, R, MK, MV, MR> {
|
|
83
78
|
/**
|
|
84
|
-
* This
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
* constructor
|
|
90
|
-
*
|
|
91
|
-
*
|
|
79
|
+
* This TypeScript constructor initializes a Red-Black Tree with optional keys, nodes, entries, or
|
|
80
|
+
* raw data.
|
|
81
|
+
* @param keysNodesEntriesOrRaws - The `keysNodesEntriesOrRaws` parameter in the constructor is an
|
|
82
|
+
* iterable that can contain either `BTNRep<K, V, RedBlackTreeNode<K, V>>` objects or `R` objects. It
|
|
83
|
+
* is used to initialize the Red-Black Tree with keys, nodes, entries, or
|
|
84
|
+
* @param [options] - The `options` parameter in the constructor is of type `RedBlackTreeOptions<K,
|
|
85
|
+
* V, R>`. It is an optional parameter that allows you to specify additional options for the
|
|
86
|
+
* RedBlackTree class. These options could include configuration settings, behavior customization, or
|
|
87
|
+
* any other parameters that are specific to
|
|
92
88
|
*/
|
|
93
|
-
constructor(keysNodesEntriesOrRaws?: Iterable<
|
|
94
|
-
protected _root:
|
|
95
|
-
|
|
96
|
-
* The function returns the root node of a tree or undefined if there is no root.
|
|
97
|
-
* @returns The root node of the tree structure, or undefined if there is no root node.
|
|
98
|
-
*/
|
|
99
|
-
get root(): NODE | undefined;
|
|
89
|
+
constructor(keysNodesEntriesOrRaws?: Iterable<BTNRep<K, V, RedBlackTreeNode<K, V>> | R>, options?: RedBlackTreeOptions<K, V, R>);
|
|
90
|
+
protected _root: RedBlackTreeNode<K, V> | undefined;
|
|
91
|
+
get root(): RedBlackTreeNode<K, V> | undefined;
|
|
100
92
|
/**
|
|
93
|
+
* Time Complexity: O(1)
|
|
94
|
+
* Space Complexity: O(1)
|
|
95
|
+
*
|
|
101
96
|
* The function creates a new Red-Black Tree node with the specified key, value, and color.
|
|
102
97
|
* @param {K} key - The key parameter represents the key value of the node being created. It is of
|
|
103
98
|
* type K, which is a generic type that can be replaced with any specific type when using the
|
|
@@ -111,28 +106,28 @@ export declare class RedBlackTree<K = any, V = any, R = object, NODE extends Red
|
|
|
111
106
|
* @returns A new instance of a RedBlackTreeNode with the specified key, value, and color is being
|
|
112
107
|
* returned.
|
|
113
108
|
*/
|
|
114
|
-
createNode(key: K, value?: V, color?: RBTNColor):
|
|
109
|
+
createNode(key: K, value?: V, color?: RBTNColor): RedBlackTreeNode<K, V>;
|
|
115
110
|
/**
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
111
|
+
* Time Complexity: O(1)
|
|
112
|
+
* Space Complexity: O(1)
|
|
113
|
+
*
|
|
114
|
+
* The function creates a new Red-Black Tree with the specified options.
|
|
115
|
+
* @param [options] - The `options` parameter is an optional object that contains additional
|
|
116
|
+
* configuration options for creating the Red-Black Tree. It has the following properties:
|
|
117
|
+
* @returns a new instance of a RedBlackTree object.
|
|
123
118
|
*/
|
|
124
|
-
createTree(options?: RedBlackTreeOptions<K, V, R>): RedBlackTree<K, V, R,
|
|
119
|
+
createTree(options?: RedBlackTreeOptions<K, V, R>): RedBlackTree<K, V, R, MK, MV, MR>;
|
|
125
120
|
/**
|
|
126
121
|
* Time Complexity: O(1)
|
|
127
122
|
* Space Complexity: O(1)
|
|
128
123
|
*
|
|
129
124
|
* The function checks if the input is an instance of the RedBlackTreeNode class.
|
|
130
|
-
* @param {BTNRep<K, V,
|
|
131
|
-
* `
|
|
132
|
-
* @returns a boolean value indicating whether the input parameter `
|
|
125
|
+
* @param {BTNRep<K, V, RedBlackTreeNode<K, V>>} keyNodeOrEntry - The parameter
|
|
126
|
+
* `keyNodeOrEntry` can be of type `R` or `BTNRep<K, V, RedBlackTreeNode<K, V>>`.
|
|
127
|
+
* @returns a boolean value indicating whether the input parameter `keyNodeOrEntry` is
|
|
133
128
|
* an instance of the `RedBlackTreeNode` class.
|
|
134
129
|
*/
|
|
135
|
-
isNode(
|
|
130
|
+
isNode(keyNodeOrEntry: BTNRep<K, V, RedBlackTreeNode<K, V>>): keyNodeOrEntry is RedBlackTreeNode<K, V>;
|
|
136
131
|
/**
|
|
137
132
|
* Time Complexity: O(1)
|
|
138
133
|
* Space Complexity: O(1)
|
|
@@ -143,12 +138,12 @@ export declare class RedBlackTree<K = any, V = any, R = object, NODE extends Red
|
|
|
143
138
|
clear(): void;
|
|
144
139
|
/**
|
|
145
140
|
* Time Complexity: O(log n)
|
|
146
|
-
* Space Complexity: O(
|
|
141
|
+
* Space Complexity: O(log n)
|
|
147
142
|
*
|
|
148
143
|
* The function adds a new node to a binary search tree and returns true if the node was successfully
|
|
149
144
|
* added.
|
|
150
|
-
* @param {BTNRep<K, V,
|
|
151
|
-
* `
|
|
145
|
+
* @param {BTNRep<K, V, RedBlackTreeNode<K, V>>} keyNodeOrEntry - The parameter
|
|
146
|
+
* `keyNodeOrEntry` can accept a value of type `R` or `BTNRep<K, V, RedBlackTreeNode<K, V>>`.
|
|
152
147
|
* @param {V} [value] - The `value` parameter is an optional value that you want to associate with
|
|
153
148
|
* the key in the data structure. It represents the value that you want to add or update in the data
|
|
154
149
|
* structure.
|
|
@@ -156,22 +151,22 @@ export declare class RedBlackTree<K = any, V = any, R = object, NODE extends Red
|
|
|
156
151
|
* the method returns true. If the node already exists and its value is updated, the method also
|
|
157
152
|
* returns true. If the node cannot be added or updated, the method returns false.
|
|
158
153
|
*/
|
|
159
|
-
add(
|
|
154
|
+
add(keyNodeOrEntry: BTNRep<K, V, RedBlackTreeNode<K, V>>, value?: V): boolean;
|
|
160
155
|
/**
|
|
161
156
|
* Time Complexity: O(log n)
|
|
162
|
-
* Space Complexity: O(
|
|
157
|
+
* Space Complexity: O(log n)
|
|
163
158
|
*
|
|
164
159
|
* The function overrides the delete method in a binary tree data structure to remove a node based on
|
|
165
160
|
* a given predicate and maintain the binary search tree properties.
|
|
166
|
-
* @param {BTNRep<K, V,
|
|
161
|
+
* @param {BTNRep<K, V, RedBlackTreeNode<K, V>>} keyNodeOrEntry - The `keyNodeOrEntry`
|
|
167
162
|
* parameter in the `override delete` method is used to specify the condition or key based on which a
|
|
168
163
|
* node should be deleted from the binary tree. It can be a key, a node, an entry, or a predicate
|
|
169
164
|
* function that determines which node(s) should be deleted.
|
|
170
|
-
* @returns The `override delete` method is returning an array of `BinaryTreeDeleteResult<
|
|
165
|
+
* @returns The `override delete` method is returning an array of `BinaryTreeDeleteResult<RedBlackTreeNode<K, V>>`
|
|
171
166
|
* objects. Each object in the array contains information about the deleted node and whether
|
|
172
167
|
* balancing is needed.
|
|
173
168
|
*/
|
|
174
|
-
delete(
|
|
169
|
+
delete(keyNodeOrEntry: BTNRep<K, V, RedBlackTreeNode<K, V>>): BinaryTreeDeleteResult<RedBlackTreeNode<K, V>>[];
|
|
175
170
|
/**
|
|
176
171
|
* Time Complexity: O(n)
|
|
177
172
|
* Space Complexity: O(n)
|
|
@@ -192,91 +187,100 @@ export declare class RedBlackTree<K = any, V = any, R = object, NODE extends Red
|
|
|
192
187
|
* @returns A new Red-Black Tree is being returned, where each entry has been transformed using the
|
|
193
188
|
* provided callback function.
|
|
194
189
|
*/
|
|
195
|
-
map
|
|
190
|
+
map(callback: EntryCallback<K, V | undefined, [MK, MV]>, options?: RedBlackTreeOptions<MK, MV, MR>, thisArg?: any): RedBlackTree<MK, MV, MR>;
|
|
191
|
+
/**
|
|
192
|
+
* Time Complexity: O(n)
|
|
193
|
+
* Space Complexity: O(n)
|
|
194
|
+
*
|
|
195
|
+
* The function `clone` overrides the default cloning behavior to create a deep copy of a tree
|
|
196
|
+
* structure.
|
|
197
|
+
* @returns The `cloned` object is being returned.
|
|
198
|
+
*/
|
|
199
|
+
clone(): RedBlackTree<K, V, R, MK, MV, MR>;
|
|
196
200
|
/**
|
|
197
201
|
* Time Complexity: O(1)
|
|
198
202
|
* Space Complexity: O(1)
|
|
199
203
|
*
|
|
200
204
|
* The function sets the root of a tree-like structure and updates the parent property of the new
|
|
201
205
|
* root.
|
|
202
|
-
* @param {
|
|
206
|
+
* @param {RedBlackTreeNode<K, V> | undefined} v - v is a parameter of type RedBlackTreeNode<K, V> or undefined.
|
|
203
207
|
*/
|
|
204
|
-
protected _setRoot(v:
|
|
208
|
+
protected _setRoot(v: RedBlackTreeNode<K, V> | undefined): void;
|
|
205
209
|
/**
|
|
206
210
|
* Time Complexity: O(1)
|
|
207
211
|
* Space Complexity: O(1)
|
|
208
212
|
*
|
|
209
213
|
* The function replaces an old node with a new node while preserving the color of the old node.
|
|
210
|
-
* @param {
|
|
214
|
+
* @param {RedBlackTreeNode<K, V>} oldNode - The `oldNode` parameter represents the node that needs to be replaced in
|
|
211
215
|
* the data structure.
|
|
212
|
-
* @param {
|
|
216
|
+
* @param {RedBlackTreeNode<K, V>} newNode - The `newNode` parameter is of type `RedBlackTreeNode<K, V>`, which represents a node in a
|
|
213
217
|
* data structure.
|
|
214
218
|
* @returns The method is returning the result of calling the `_replaceNode` method from the
|
|
215
219
|
* superclass, with the `oldNode` and `newNode` parameters.
|
|
216
220
|
*/
|
|
217
|
-
protected _replaceNode(oldNode:
|
|
221
|
+
protected _replaceNode(oldNode: RedBlackTreeNode<K, V>, newNode: RedBlackTreeNode<K, V>): RedBlackTreeNode<K, V>;
|
|
218
222
|
/**
|
|
219
223
|
* Time Complexity: O(log n)
|
|
220
|
-
* Space Complexity: O(
|
|
224
|
+
* Space Complexity: O(log n)
|
|
221
225
|
*
|
|
222
226
|
* The `_insert` function inserts a node into a binary search tree and performs necessary fix-ups to
|
|
223
227
|
* maintain the red-black tree properties.
|
|
224
|
-
* @param {
|
|
228
|
+
* @param {RedBlackTreeNode<K, V>} node - The `node` parameter represents the node that needs to be inserted into the
|
|
225
229
|
* binary search tree.
|
|
226
230
|
* @returns a string value indicating the result of the insertion operation. It can return either
|
|
227
231
|
* 'UPDATED' if the node with the same key already exists and was updated, or 'CREATED' if a new node
|
|
228
232
|
* was created and inserted into the tree.
|
|
229
233
|
*/
|
|
230
|
-
protected _insert(node:
|
|
234
|
+
protected _insert(node: RedBlackTreeNode<K, V>): CRUD;
|
|
231
235
|
/**
|
|
232
236
|
* Time Complexity: O(1)
|
|
233
237
|
* Space Complexity: O(1)
|
|
234
238
|
*
|
|
235
239
|
* The function `_transplant` is used to replace a node `u` with another node `v` in a binary tree.
|
|
236
|
-
* @param {
|
|
237
|
-
* @param {
|
|
238
|
-
* either be a `
|
|
240
|
+
* @param {RedBlackTreeNode<K, V>} u - The parameter "u" represents a node in a binary tree.
|
|
241
|
+
* @param {RedBlackTreeNode<K, V> | undefined} v - The parameter `v` is of type `RedBlackTreeNode<K, V> | undefined`, which means it can
|
|
242
|
+
* either be a `RedBlackTreeNode<K, V>` object or `undefined`.
|
|
239
243
|
*/
|
|
240
|
-
protected _transplant(u:
|
|
244
|
+
protected _transplant(u: RedBlackTreeNode<K, V>, v: RedBlackTreeNode<K, V> | undefined): void;
|
|
241
245
|
/**
|
|
242
246
|
* Time Complexity: O(log n)
|
|
243
247
|
* Space Complexity: O(1)
|
|
244
248
|
*
|
|
245
249
|
* The `_insertFixup` function is used to fix the Red-Black Tree after inserting a new node.
|
|
246
|
-
* @param {
|
|
250
|
+
* @param {RedBlackTreeNode<K, V> | undefined} z - The parameter `z` represents a node in the Red-Black Tree data
|
|
247
251
|
* structure. It can either be a valid node or `undefined`.
|
|
248
252
|
*/
|
|
249
|
-
protected _insertFixup(z:
|
|
253
|
+
protected _insertFixup(z: RedBlackTreeNode<K, V> | undefined): void;
|
|
250
254
|
/**
|
|
251
255
|
* Time Complexity: O(log n)
|
|
252
256
|
* Space Complexity: O(1)
|
|
253
257
|
*
|
|
254
258
|
* The `_deleteFixup` function is used to fix the red-black tree after a node deletion by adjusting
|
|
255
259
|
* the colors and performing rotations.
|
|
256
|
-
* @param {
|
|
260
|
+
* @param {RedBlackTreeNode<K, V> | undefined} node - The `node` parameter represents a node in a binary tree. It can
|
|
257
261
|
* be either a valid node object or `undefined`.
|
|
258
262
|
* @returns The function does not return any value. It has a return type of `void`, which means it
|
|
259
263
|
* does not return anything.
|
|
260
264
|
*/
|
|
261
|
-
protected _deleteFixup(node:
|
|
265
|
+
protected _deleteFixup(node: RedBlackTreeNode<K, V> | undefined): void;
|
|
262
266
|
/**
|
|
263
267
|
* Time Complexity: O(1)
|
|
264
268
|
* Space Complexity: O(1)
|
|
265
269
|
*
|
|
266
270
|
* The `_leftRotate` function performs a left rotation on a given node in a binary tree.
|
|
267
|
-
* @param {
|
|
271
|
+
* @param {RedBlackTreeNode<K, V> | undefined} x - The parameter `x` is of type `RedBlackTreeNode<K, V> | undefined`. It represents a
|
|
268
272
|
* node in a binary tree or `undefined` if there is no node.
|
|
269
273
|
* @returns void, which means it does not return any value.
|
|
270
274
|
*/
|
|
271
|
-
protected _leftRotate(x:
|
|
275
|
+
protected _leftRotate(x: RedBlackTreeNode<K, V> | undefined): void;
|
|
272
276
|
/**
|
|
273
277
|
* Time Complexity: O(1)
|
|
274
278
|
* Space Complexity: O(1)
|
|
275
279
|
*
|
|
276
280
|
* The `_rightRotate` function performs a right rotation on a given node in a binary tree.
|
|
277
|
-
* @param {
|
|
281
|
+
* @param {RedBlackTreeNode<K, V> | undefined} y - The parameter `y` is of type `RedBlackTreeNode<K, V> | undefined`. It represents a
|
|
278
282
|
* node in a binary tree or `undefined` if there is no node.
|
|
279
283
|
* @returns void, which means it does not return any value.
|
|
280
284
|
*/
|
|
281
|
-
protected _rightRotate(y:
|
|
285
|
+
protected _rightRotate(y: RedBlackTreeNode<K, V> | undefined): void;
|
|
282
286
|
}
|