Add binary search tree.

This commit is contained in:
Oleksii Trekhleb
2018-04-03 07:50:30 +03:00
parent b89e406444
commit 1c911aadf0
4 changed files with 22 additions and 4 deletions

View File

@@ -14,7 +14,7 @@ export default class BinarySearchTree {
}
remove(value) {
const nodeToRemove = this.findNode(value);
const nodeToRemove = this.root.find(value);
if (!nodeToRemove) {
throw new Error('Item not found in the tree');