humanwhocodes/computer-science-in-javascript

Incorrect removal in BST?

markelog opened this issue · 0 comments

var bst = new BinarySearchTree();

bst.add(8);
bst.add(3);
bst.add(1);
bst.add(10);

bst.add(6);
bst.add(4);
bst.add(7);
bst.add(14);
bst.add(13);

bst.remove(3);
bst.traverse(node => {
// Error
    console.log(node.value);
});

?