algorithms
algorithms copied to clipboard
bst.go tree.Delete() function mistake?
https://github.com/arnauddri/algorithms/blob/736f5ebe59cfd72b778704fe9ba5e0ba25c775fe/data-structures/binary-tree/bst.go#L136
I think it should be
if parent.Left == h
n
is never gonna equal to parent.Left
right?, they don't have the same address. We only use n
pass to function Compare
to determine which way should we go in the tree.
If I miss something, please point it out to me. Thanks
You are actually right. it may cause incorrect modifications. https://github.com/arnauddri/algorithms/pull/15