(Java) Problem 15.11

#1

Hi,

I think there is a problem with 15.11, more specifically the case in which the node to be deleted is the root.

The following fragment is in the book:
root = keyNode.left;
keyNode.left = null;

where keyNode is the node to be deleted. I think in this case the correct code is keyNode = null to prevent loitering.

0 Likes

#2

More than this, I think the last keyNode.left = null is flawed, it should’ve been keyNode = null.

0 Likes

#3

Hey @daemoohn,

I think you can try to download the code and test with the cases you think that might be problematic. From our test, there is no problem on that.

0 Likes