Skip to content

Commit 604fc5a

Browse files
💥 refactor!: Rename RedBlackTree#_delete to unlink.
Progress on #68. BREAKING CHANGE: This breaks dependents of the _delete method.
1 parent 6798cbd commit 604fc5a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/types/RedBlackTree.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export default class RedBlackTree {
108108
*
109109
* @param {Node} node - The input node to delete.
110110
*/
111-
_delete(node) {
111+
unlink(node) {
112112
assert(node instanceof Node);
113113
if (node.left !== null) {
114114
// Swap node with its predecessor
@@ -191,7 +191,7 @@ export default class RedBlackTree {
191191
/**
192192
* Search for the first node of the tree whose key equals the input key
193193
* (with {@link RedBlackTree#_search}), then delete that node
194-
* (with {@link RedBlackTree#_delete}). If such a node is found and deleted
194+
* (with {@link RedBlackTree#unlink}). If such a node is found and deleted
195195
* then return <code>true</code>. Return <code>false</code> otherwise.
196196
*
197197
* @param {any} key - The input key.
@@ -201,7 +201,7 @@ export default class RedBlackTree {
201201
const node = this._search(key);
202202
if (node === null) return false;
203203

204-
this._delete(node);
204+
this.unlink(node);
205205
return true;
206206
}
207207

0 commit comments

Comments
 (0)