Red-Black-Tree
Red-Black-Tree copied to clipboard
deleteValue not working properly
RBTree rbTree1;
rbTree1.insertValue(1);
rbTree1.insertValue(2);
rbTree1.inorder();//output 1, 2
rbTree1.deleteValue(1);
rbTree1.inorder();//output nothing
The impl is not correct, here we set the root to null in fixDeleteTree:
if (node == root) {
root = nullptr;
return;
}