Red-Black-Tree icon indicating copy to clipboard operation
Red-Black-Tree copied to clipboard

deleteValue not working properly

Open lxb007981 opened this issue 5 years ago • 1 comments

RBTree rbTree1;
rbTree1.insertValue(1);
rbTree1.insertValue(2);
rbTree1.inorder();//output 1, 2
rbTree1.deleteValue(1);
rbTree1.inorder();//output nothing

lxb007981 avatar Dec 22 '19 06:12 lxb007981

The impl is not correct, here we set the root to null in fixDeleteTree:

if (node == root) {
    root = nullptr;
    return;
  }

mingyuanlee avatar Jan 07 '24 19:01 mingyuanlee