algorithms icon indicating copy to clipboard operation
algorithms copied to clipboard

bst.go tree.Delete() function mistake?

Open WuShaoQiang opened this issue 5 years ago • 2 comments

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.

WuShaoQiang avatar Apr 16 '19 05:04 WuShaoQiang

If I miss something, please point it out to me. Thanks

WuShaoQiang avatar Apr 16 '19 05:04 WuShaoQiang

You are actually right. it may cause incorrect modifications. https://github.com/arnauddri/algorithms/pull/15

Mohammadjafari80 avatar Feb 04 '21 12:02 Mohammadjafari80