min-heap-typed 1.50.1 → 1.50.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/dist/data-structures/base/iterable-base.d.ts +120 -9
  2. package/dist/data-structures/base/iterable-base.js +143 -7
  3. package/dist/data-structures/binary-tree/avl-tree.d.ts +72 -47
  4. package/dist/data-structures/binary-tree/avl-tree.js +101 -72
  5. package/dist/data-structures/binary-tree/binary-indexed-tree.d.ts +22 -0
  6. package/dist/data-structures/binary-tree/binary-indexed-tree.js +22 -0
  7. package/dist/data-structures/binary-tree/binary-tree.d.ts +244 -199
  8. package/dist/data-structures/binary-tree/binary-tree.js +484 -376
  9. package/dist/data-structures/binary-tree/bst.d.ts +92 -79
  10. package/dist/data-structures/binary-tree/bst.js +68 -76
  11. package/dist/data-structures/binary-tree/rb-tree.d.ts +127 -57
  12. package/dist/data-structures/binary-tree/rb-tree.js +152 -99
  13. package/dist/data-structures/binary-tree/segment-tree.d.ts +99 -6
  14. package/dist/data-structures/binary-tree/segment-tree.js +127 -10
  15. package/dist/data-structures/binary-tree/tree-multimap.d.ts +72 -58
  16. package/dist/data-structures/binary-tree/tree-multimap.js +102 -85
  17. package/dist/data-structures/graph/abstract-graph.d.ts +1 -78
  18. package/dist/data-structures/graph/abstract-graph.js +3 -189
  19. package/dist/data-structures/graph/directed-graph.d.ts +73 -0
  20. package/dist/data-structures/graph/directed-graph.js +131 -0
  21. package/dist/data-structures/graph/map-graph.d.ts +8 -0
  22. package/dist/data-structures/graph/map-graph.js +14 -0
  23. package/dist/data-structures/graph/undirected-graph.d.ts +76 -7
  24. package/dist/data-structures/graph/undirected-graph.js +151 -18
  25. package/dist/data-structures/hash/hash-map.d.ts +254 -28
  26. package/dist/data-structures/hash/hash-map.js +347 -78
  27. package/dist/data-structures/heap/heap.d.ts +95 -25
  28. package/dist/data-structures/heap/heap.js +95 -26
  29. package/dist/data-structures/linked-list/doubly-linked-list.d.ts +126 -63
  30. package/dist/data-structures/linked-list/doubly-linked-list.js +141 -77
  31. package/dist/data-structures/linked-list/singly-linked-list.d.ts +154 -106
  32. package/dist/data-structures/linked-list/singly-linked-list.js +164 -115
  33. package/dist/data-structures/linked-list/skip-linked-list.d.ts +63 -36
  34. package/dist/data-structures/linked-list/skip-linked-list.js +63 -36
  35. package/dist/data-structures/matrix/matrix.d.ts +35 -4
  36. package/dist/data-structures/matrix/matrix.js +50 -11
  37. package/dist/data-structures/priority-queue/max-priority-queue.d.ts +10 -0
  38. package/dist/data-structures/priority-queue/max-priority-queue.js +10 -0
  39. package/dist/data-structures/priority-queue/min-priority-queue.d.ts +11 -0
  40. package/dist/data-structures/priority-queue/min-priority-queue.js +11 -0
  41. package/dist/data-structures/priority-queue/priority-queue.d.ts +8 -0
  42. package/dist/data-structures/priority-queue/priority-queue.js +8 -0
  43. package/dist/data-structures/queue/deque.d.ts +139 -35
  44. package/dist/data-structures/queue/deque.js +200 -62
  45. package/dist/data-structures/queue/queue.d.ts +103 -49
  46. package/dist/data-structures/queue/queue.js +111 -49
  47. package/dist/data-structures/stack/stack.d.ts +51 -21
  48. package/dist/data-structures/stack/stack.js +58 -22
  49. package/dist/data-structures/tree/tree.d.ts +57 -3
  50. package/dist/data-structures/tree/tree.js +77 -11
  51. package/dist/data-structures/trie/trie.d.ts +135 -34
  52. package/dist/data-structures/trie/trie.js +153 -33
  53. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +1 -1
  54. package/dist/types/data-structures/hash/hash-map.d.ts +4 -3
  55. package/dist/types/utils/utils.d.ts +1 -0
  56. package/package.json +2 -2
  57. package/src/data-structures/base/iterable-base.ts +184 -19
  58. package/src/data-structures/binary-tree/avl-tree.ts +134 -100
  59. package/src/data-structures/binary-tree/binary-indexed-tree.ts +22 -0
  60. package/src/data-structures/binary-tree/binary-tree.ts +674 -671
  61. package/src/data-structures/binary-tree/bst.ts +127 -136
  62. package/src/data-structures/binary-tree/rb-tree.ts +199 -166
  63. package/src/data-structures/binary-tree/segment-tree.ts +145 -11
  64. package/src/data-structures/binary-tree/tree-multimap.ts +138 -115
  65. package/src/data-structures/graph/abstract-graph.ts +4 -211
  66. package/src/data-structures/graph/directed-graph.ts +152 -0
  67. package/src/data-structures/graph/map-graph.ts +15 -0
  68. package/src/data-structures/graph/undirected-graph.ts +171 -19
  69. package/src/data-structures/hash/hash-map.ts +389 -96
  70. package/src/data-structures/heap/heap.ts +97 -26
  71. package/src/data-structures/linked-list/doubly-linked-list.ts +156 -83
  72. package/src/data-structures/linked-list/singly-linked-list.ts +174 -120
  73. package/src/data-structures/linked-list/skip-linked-list.ts +63 -37
  74. package/src/data-structures/matrix/matrix.ts +52 -12
  75. package/src/data-structures/priority-queue/max-priority-queue.ts +10 -0
  76. package/src/data-structures/priority-queue/min-priority-queue.ts +11 -0
  77. package/src/data-structures/priority-queue/priority-queue.ts +8 -0
  78. package/src/data-structures/queue/deque.ts +225 -70
  79. package/src/data-structures/queue/queue.ts +118 -49
  80. package/src/data-structures/stack/stack.ts +63 -23
  81. package/src/data-structures/tree/tree.ts +89 -15
  82. package/src/data-structures/trie/trie.ts +173 -38
  83. package/src/types/data-structures/binary-tree/binary-tree.ts +1 -1
  84. package/src/types/data-structures/hash/hash-map.ts +4 -3
  85. package/src/types/utils/utils.ts +2 -0
@@ -5,12 +5,33 @@
5
5
  * @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
6
6
  * @license MIT License
7
7
  */
8
- import { BinaryTreeDeleteResult, BTNCallback, IterationType, KeyOrNodeOrEntry, RBTNColor, RBTreeOptions, RedBlackTreeNested, RedBlackTreeNodeNested } from '../../types';
8
+ import { BinaryTreeDeleteResult, BSTNKeyOrNode, BTNCallback, KeyOrNodeOrEntry, RBTNColor, RBTreeOptions, RedBlackTreeNested, RedBlackTreeNodeNested } from '../../types';
9
9
  import { BST, BSTNode } from './bst';
10
10
  import { IBinaryTree } from '../../interfaces';
11
- export declare class RedBlackTreeNode<K = any, V = any, N extends RedBlackTreeNode<K, V, N> = RedBlackTreeNodeNested<K, V>> extends BSTNode<K, V, N> {
12
- color: RBTNColor;
11
+ export declare class RedBlackTreeNode<K = any, V = any, NODE extends RedBlackTreeNode<K, V, NODE> = RedBlackTreeNodeNested<K, V>> extends BSTNode<K, V, NODE> {
12
+ /**
13
+ * The constructor function initializes a Red-Black Tree Node with a key, an optional value, and a
14
+ * color.
15
+ * @param {K} key - The key parameter is of type K and represents the key of the node in the
16
+ * Red-Black Tree.
17
+ * @param {V} [value] - The `value` parameter is an optional parameter that represents the value
18
+ * associated with the key in the Red-Black Tree Node. It is not required and can be omitted when
19
+ * creating a new instance of the Red-Black Tree Node.
20
+ * @param {RBTNColor} color - The `color` parameter is used to specify the color of the Red-Black
21
+ * Tree Node. It is an optional parameter with a default value of `RBTNColor.BLACK`.
22
+ */
13
23
  constructor(key: K, value?: V, color?: RBTNColor);
24
+ protected _color: RBTNColor;
25
+ /**
26
+ * The function returns the color value of a variable.
27
+ * @returns The color value stored in the protected variable `_color`.
28
+ */
29
+ get color(): RBTNColor;
30
+ /**
31
+ * The function sets the color property to the specified value.
32
+ * @param {RBTNColor} value - The value parameter is of type RBTNColor.
33
+ */
34
+ set color(value: RBTNColor);
14
35
  }
15
36
  /**
16
37
  * 1. Each node is either red or black.
@@ -19,12 +40,11 @@ export declare class RedBlackTreeNode<K = any, V = any, N extends RedBlackTreeNo
19
40
  * 4. Red nodes must have black children.
20
41
  * 5. Black balance: Every path from any node to each of its leaf nodes contains the same number of black nodes.
21
42
  */
22
- export declare class RedBlackTree<K = any, V = any, N extends RedBlackTreeNode<K, V, N> = RedBlackTreeNode<K, V, RedBlackTreeNodeNested<K, V>>, TREE extends RedBlackTree<K, V, N, TREE> = RedBlackTree<K, V, N, RedBlackTreeNested<K, V, N>>> extends BST<K, V, N, TREE> implements IBinaryTree<K, V, N, TREE> {
23
- Sentinel: N;
43
+ export declare class RedBlackTree<K = any, V = any, NODE extends RedBlackTreeNode<K, V, NODE> = RedBlackTreeNode<K, V, RedBlackTreeNodeNested<K, V>>, TREE extends RedBlackTree<K, V, NODE, TREE> = RedBlackTree<K, V, NODE, RedBlackTreeNested<K, V, NODE>>> extends BST<K, V, NODE, TREE> implements IBinaryTree<K, V, NODE, TREE> {
24
44
  /**
25
45
  * This is the constructor function for a Red-Black Tree data structure in TypeScript, which
26
46
  * initializes the tree with optional nodes and options.
27
- * @param [keysOrNodesOrEntries] - The `keysOrNodesOrEntries` parameter is an optional iterable of `KeyOrNodeOrEntry<K, V, N>`
47
+ * @param [keysOrNodesOrEntries] - The `keysOrNodesOrEntries` parameter is an optional iterable of `KeyOrNodeOrEntry<K, V, NODE>`
28
48
  * objects. It represents the initial nodes that will be added to the RBTree during its
29
49
  * construction. If this parameter is provided, the `addMany` method is called to add all the
30
50
  * nodes to the
@@ -32,10 +52,24 @@ export declare class RedBlackTree<K = any, V = any, N extends RedBlackTreeNode<K
32
52
  * behavior of the RBTree. It is of type `Partial<RBTreeOptions>`, which means that you can provide
33
53
  * only a subset of the properties defined in the `RBTreeOptions` interface.
34
54
  */
35
- constructor(keysOrNodesOrEntries?: Iterable<KeyOrNodeOrEntry<K, V, N>>, options?: RBTreeOptions<K>);
36
- protected _root: N;
37
- get root(): N;
55
+ constructor(keysOrNodesOrEntries?: Iterable<KeyOrNodeOrEntry<K, V, NODE>>, options?: RBTreeOptions<K>);
56
+ protected _Sentinel: NODE;
57
+ /**
58
+ * The function returns the value of the `_Sentinel` property.
59
+ * @returns The method is returning the value of the `_Sentinel` property.
60
+ */
61
+ get Sentinel(): NODE;
62
+ protected _root: NODE;
63
+ /**
64
+ * The function returns the root node.
65
+ * @returns The root node of the data structure.
66
+ */
67
+ get root(): NODE;
38
68
  protected _size: number;
69
+ /**
70
+ * The function returns the size of an object.
71
+ * @returns The size of the object, which is a number.
72
+ */
39
73
  get size(): number;
40
74
  /**
41
75
  * The function creates a new Red-Black Tree node with the specified key, value, and color.
@@ -49,7 +83,7 @@ export declare class RedBlackTree<K = any, V = any, N extends RedBlackTreeNode<K
49
83
  * @returns The method is returning a new instance of a RedBlackTreeNode with the specified key,
50
84
  * value, and color.
51
85
  */
52
- createNode(key: K, value?: V, color?: RBTNColor): N;
86
+ createNode(key: K, value?: V, color?: RBTNColor): NODE;
53
87
  /**
54
88
  * The function creates a Red-Black Tree with the specified options and returns it.
55
89
  * @param {RBTreeOptions} [options] - The `options` parameter is an optional object that can be
@@ -59,30 +93,32 @@ export declare class RedBlackTree<K = any, V = any, N extends RedBlackTreeNode<K
59
93
  */
60
94
  createTree(options?: RBTreeOptions<K>): TREE;
61
95
  /**
62
- * The function `exemplarToNode` takes an keyOrNodeOrEntry and converts it into a node object if possible.
63
- * @param keyOrNodeOrEntry - The `keyOrNodeOrEntry` parameter is of type `KeyOrNodeOrEntry<K, V, N>`, where:
96
+ * The function `keyValueOrEntryToNode` takes an keyOrNodeOrEntry and converts it into a node object if possible.
97
+ * @param keyOrNodeOrEntry - The `keyOrNodeOrEntry` parameter is of type `KeyOrNodeOrEntry<K, V, NODE>`, where:
64
98
  * @param {V} [value] - The `value` parameter is an optional value that can be passed to the
65
- * `exemplarToNode` function. It represents the value associated with the keyOrNodeOrEntry node. If a value
99
+ * `keyValueOrEntryToNode` function. It represents the value associated with the keyOrNodeOrEntry node. If a value
66
100
  * is provided, it will be used when creating the new node. If no value is provided, the new node
67
- * @returns a node of type N or undefined.
101
+ * @returns a node of type NODE or undefined.
68
102
  */
69
- exemplarToNode(keyOrNodeOrEntry: KeyOrNodeOrEntry<K, V, N>, value?: V): N | undefined;
103
+ keyValueOrEntryToNode(keyOrNodeOrEntry: KeyOrNodeOrEntry<K, V, NODE>, value?: V): NODE | undefined;
70
104
  /**
71
105
  * The function checks if an keyOrNodeOrEntry is an instance of the RedBlackTreeNode class.
72
- * @param keyOrNodeOrEntry - The `keyOrNodeOrEntry` parameter is of type `KeyOrNodeOrEntry<K, V, N>`.
106
+ * @param keyOrNodeOrEntry - The `keyOrNodeOrEntry` parameter is of type `KeyOrNodeOrEntry<K, V, NODE>`.
73
107
  * @returns a boolean value indicating whether the keyOrNodeOrEntry is an instance of the RedBlackTreeNode
74
108
  * class.
75
109
  */
76
- isNode(keyOrNodeOrEntry: KeyOrNodeOrEntry<K, V, N>): keyOrNodeOrEntry is N;
110
+ isNode(keyOrNodeOrEntry: KeyOrNodeOrEntry<K, V, NODE>): keyOrNodeOrEntry is NODE;
77
111
  /**
78
- * Time Complexity: O(log n) on average (where n is the number of nodes in the tree)
79
- * Space Complexity: O(1)
112
+ * The function checks if a given node is a real node in a Red-Black Tree.
113
+ * @param {NODE | undefined} node - The `node` parameter is of type `NODE | undefined`, which means
114
+ * it can either be of type `NODE` or `undefined`.
115
+ * @returns a boolean value.
80
116
  */
81
- isRealNode(node: N | undefined): node is N;
117
+ isRealNode(node: NODE | undefined): node is NODE;
82
118
  /**
83
119
  * Time Complexity: O(log n)
84
120
  * Space Complexity: O(1)
85
- * on average (where n is the number of nodes in the tree)
121
+ * On average (where n is the number of nodes in the tree)
86
122
  */
87
123
  /**
88
124
  * Time Complexity: O(log n)
@@ -94,13 +130,12 @@ export declare class RedBlackTree<K = any, V = any, N extends RedBlackTreeNode<K
94
130
  * entry.
95
131
  * @param {V} [value] - The `value` parameter represents the value associated with the key that is
96
132
  * being added to the binary search tree.
97
- * @returns The method `add` returns either the newly added node (`N`) or `undefined`.
133
+ * @returns The method `add` returns either the newly added node (`NODE`) or `undefined`.
98
134
  */
99
- add(keyOrNodeOrEntry: KeyOrNodeOrEntry<K, V, N>, value?: V): boolean;
135
+ add(keyOrNodeOrEntry: KeyOrNodeOrEntry<K, V, NODE>, value?: V): boolean;
100
136
  /**
101
137
  * Time Complexity: O(log n)
102
138
  * Space Complexity: O(1)
103
- * on average (where n is the number of nodes in the tree)
104
139
  */
105
140
  /**
106
141
  * Time Complexity: O(log n)
@@ -112,15 +147,49 @@ export declare class RedBlackTree<K = any, V = any, N extends RedBlackTreeNode<K
112
147
  * that you want to use to identify the node that you want to delete from the binary tree. It can be
113
148
  * of any type that is returned by the callback function `C`. It can also be `null` or `undefined` if
114
149
  * you don't want to
115
- * @param {C} callback - The `callback` parameter is a function that takes a node of type `N` and
150
+ * @param {C} callback - The `callback` parameter is a function that takes a node of type `NODE` and
116
151
  * returns a value of type `ReturnType<C>`. It is used to determine if a node should be deleted based
117
152
  * on its identifier. The `callback` function is optional and defaults to `this._defaultOneParam
118
- * @returns an array of `BinaryTreeDeleteResult<N>`.
153
+ * @returns an array of `BinaryTreeDeleteResult<NODE>`.
119
154
  */
120
- delete<C extends BTNCallback<N>>(identifier: ReturnType<C> | null | undefined, callback?: C): BinaryTreeDeleteResult<N>[];
121
- getNode<C extends BTNCallback<N, K>>(identifier: K, callback?: C, beginRoot?: N | undefined, iterationType?: IterationType): N | undefined;
122
- getNode<C extends BTNCallback<N, N>>(identifier: N | undefined, callback?: C, beginRoot?: N | undefined, iterationType?: IterationType): N | undefined;
123
- getNode<C extends BTNCallback<N>>(identifier: ReturnType<C>, callback: C, beginRoot?: N | undefined, iterationType?: IterationType): N | undefined;
155
+ delete<C extends BTNCallback<NODE>>(identifier: ReturnType<C> | null | undefined, callback?: C): BinaryTreeDeleteResult<NODE>[];
156
+ /**
157
+ * Time Complexity: O(log n)
158
+ * Space Complexity: O(1)
159
+ */
160
+ /**
161
+ * Time Complexity: O(log n)
162
+ * Space Complexity: O(1)
163
+ *
164
+ * The function `getNode` retrieves a single node from a binary tree based on a given identifier and
165
+ * callback function.
166
+ * @param {ReturnType<C> | undefined} identifier - The `identifier` parameter is the value used to
167
+ * identify the node you want to retrieve. It can be of any type that is the return type of the `C`
168
+ * callback function. If the `identifier` is `undefined`, it means you want to retrieve the first
169
+ * node that matches the other criteria
170
+ * @param {C} callback - The `callback` parameter is a function that will be called for each node in
171
+ * the binary tree. It is used to determine if a node matches the given identifier. The `callback`
172
+ * function should take a single parameter of type `NODE` (the type of the nodes in the binary tree) and
173
+ * @param {K | NODE | undefined} beginRoot - The `beginRoot` parameter is the starting point for
174
+ * searching for a node in a binary tree. It can be either a key value or a node object. If it is not
175
+ * provided, the search will start from the root of the binary tree.
176
+ * @param iterationType - The `iterationType` parameter is a variable that determines the type of
177
+ * iteration to be performed when searching for nodes in the binary tree. It is used in the
178
+ * `getNodes` method, which is called within the `getNode` method.
179
+ * @returns a value of type `NODE`, `null`, or `undefined`.
180
+ */
181
+ getNode<C extends BTNCallback<NODE>>(identifier: ReturnType<C> | undefined, callback?: C, beginRoot?: BSTNKeyOrNode<K, NODE>, iterationType?: import("../../types").IterationType): NODE | null | undefined;
182
+ /**
183
+ * Time Complexity: O(1)
184
+ * Space Complexity: O(1)
185
+ */
186
+ /**
187
+ * Time Complexity: O(1)
188
+ * Space Complexity: O(1)
189
+ *
190
+ * The "clear" function sets the root node to the sentinel node and resets the size to 0.
191
+ */
192
+ clear(): void;
124
193
  /**
125
194
  * Time Complexity: O(log n)
126
195
  * Space Complexity: O(1)
@@ -134,13 +203,14 @@ export declare class RedBlackTree<K = any, V = any, N extends RedBlackTreeNode<K
134
203
  * Red-Black Tree.
135
204
  * @returns the predecessor of the given RedBlackTreeNode 'x'.
136
205
  */
137
- getPredecessor(x: N): N;
206
+ getPredecessor(x: NODE): NODE;
138
207
  /**
139
- * Time Complexity: O(1)
140
- * Space Complexity: O(1)
208
+ * The function sets the root node of a tree structure and updates the parent property of the new
209
+ * root node.
210
+ * @param {NODE} v - The parameter "v" is of type "NODE", which represents a node in a data
211
+ * structure.
141
212
  */
142
- clear(): void;
143
- protected _setRoot(v: N): void;
213
+ protected _setRoot(v: NODE): void;
144
214
  /**
145
215
  * Time Complexity: O(1)
146
216
  * Space Complexity: O(1)
@@ -150,9 +220,9 @@ export declare class RedBlackTree<K = any, V = any, N extends RedBlackTreeNode<K
150
220
  * Space Complexity: O(1)
151
221
  *
152
222
  * The function performs a left rotation on a binary tree node.
153
- * @param {RedBlackTreeNode} x - The parameter `x` is of type `N`, which likely represents a node in a binary tree.
223
+ * @param {RedBlackTreeNode} x - The parameter `x` is of type `NODE`, which likely represents a node in a binary tree.
154
224
  */
155
- protected _leftRotate(x: N): void;
225
+ protected _leftRotate(x: NODE): void;
156
226
  /**
157
227
  * Time Complexity: O(1)
158
228
  * Space Complexity: O(1)
@@ -165,7 +235,7 @@ export declare class RedBlackTree<K = any, V = any, N extends RedBlackTreeNode<K
165
235
  * @param {RedBlackTreeNode} x - x is a RedBlackTreeNode, which represents the node that needs to be right
166
236
  * rotated.
167
237
  */
168
- protected _rightRotate(x: N): void;
238
+ protected _rightRotate(x: NODE): void;
169
239
  /**
170
240
  * Time Complexity: O(log n)
171
241
  * Space Complexity: O(1)
@@ -174,44 +244,44 @@ export declare class RedBlackTree<K = any, V = any, N extends RedBlackTreeNode<K
174
244
  * Time Complexity: O(log n)
175
245
  * Space Complexity: O(1)
176
246
  *
177
- * The function `_fixDelete` is used to fix the red-black tree after a node deletion.
178
- * @param {RedBlackTreeNode} x - The parameter `x` represents a node in a Red-Black Tree (RBT).
247
+ * The `_fixInsert` function is used to fix the red-black tree after an insertion operation.
248
+ * @param {RedBlackTreeNode} k - The parameter `k` is a RedBlackTreeNode object, which represents a node in a
249
+ * red-black tree.
179
250
  */
180
- protected _fixDelete(x: N): void;
251
+ protected _fixInsert(k: NODE): void;
181
252
  /**
182
- * Time Complexity: O(1)
253
+ * Time Complexity: O(log n)
183
254
  * Space Complexity: O(1)
184
255
  */
185
256
  /**
186
- * Time Complexity: O(1)
257
+ * Time Complexity: O(log n)
187
258
  * Space Complexity: O(1)
188
259
  *
189
- * The function `_rbTransplant` replaces one node in a red-black tree with another node.
190
- * @param {RedBlackTreeNode} u - The parameter "u" represents a RedBlackTreeNode object.
191
- * @param {RedBlackTreeNode} v - The parameter "v" is a RedBlackTreeNode object.
260
+ * The function `_fixDelete` is used to fix the red-black tree after a node deletion.
261
+ * @param {RedBlackTreeNode} x - The parameter `x` represents a node in a Red-Black Tree (RBT).
192
262
  */
193
- protected _rbTransplant(u: N, v: N): void;
263
+ protected _fixDelete(x: NODE): void;
194
264
  /**
195
- * Time Complexity: O(log n)
265
+ * Time Complexity: O(1)
196
266
  * Space Complexity: O(1)
197
267
  */
198
268
  /**
199
- * Time Complexity: O(log n)
269
+ * Time Complexity: O(1)
200
270
  * Space Complexity: O(1)
201
271
  *
202
- * The `_fixInsert` function is used to fix the red-black tree after an insertion operation.
203
- * @param {RedBlackTreeNode} k - The parameter `k` is a RedBlackTreeNode object, which represents a node in a
204
- * red-black tree.
272
+ * The function `_rbTransplant` replaces one node in a red-black tree with another node.
273
+ * @param {RedBlackTreeNode} u - The parameter "u" represents a RedBlackTreeNode object.
274
+ * @param {RedBlackTreeNode} v - The parameter "v" is a RedBlackTreeNode object.
205
275
  */
206
- protected _fixInsert(k: N): void;
276
+ protected _rbTransplant(u: NODE, v: NODE): void;
207
277
  /**
208
278
  * The function replaces an old node with a new node while preserving the color of the old node.
209
- * @param {N} oldNode - The `oldNode` parameter represents the node that needs to be replaced in a
210
- * data structure. It is of type `N`, which is the type of the nodes in the data structure.
211
- * @param {N} newNode - The `newNode` parameter is the node that will replace the `oldNode` in the
279
+ * @param {NODE} oldNode - The `oldNode` parameter represents the node that needs to be replaced in a
280
+ * data structure. It is of type `NODE`, which is the type of the nodes in the data structure.
281
+ * @param {NODE} newNode - The `newNode` parameter is the node that will replace the `oldNode` in the
212
282
  * data structure.
213
283
  * @returns The method is returning the result of calling the `_replaceNode` method from the
214
284
  * superclass, passing in the `oldNode` and `newNode` as arguments.
215
285
  */
216
- protected _replaceNode(oldNode: N, newNode: N): N;
286
+ protected _replaceNode(oldNode: NODE, newNode: NODE): NODE;
217
287
  }