# The following lines talks about deleting a node in a binary tree.(the tree property must not be violated after deletion) i) from root search for the node to be deleted ii) iii) delete the node at what must be statement ii) and fill up statement iii)

+1 vote
The following lines talks about deleting a node in a binary tree.(the tree property must not be violated after deletion)

i) from root search for the node to be deleted

ii)

iii) delete the node at

what must be statement ii) and fill up statement iii)

(a) ii)-find random node,replace with node to be deleted. iii)- delete the node

(b) ii)-find node to be deleted. iii)- delete the node at found location

(c) ii)-find deepest node,replace with node to be deleted. iii)- delete a node

(d) ii)-find deepest node,replace with node to be deleted. iii)- delete the deepest node

Enquiry is from Binary Trees using Linked Lists in chapter Binary Trees of Data Structures & Algorithms I

The question was asked during an online interview.

+1 vote
by (789k points)
selected by

The correct option is (d) ii)-find deepest node,replace with node to be deleted. iii)- delete the deepest node

Easiest explanation - We just replace a to be deleted node with last leaf node of a tree. this must not be done in case of BST or heaps.

+1 vote
+1 vote
+1 vote
+1 vote
+1 vote
+1 vote
+1 vote
+1 vote
+1 vote
+1 vote
+1 vote
+1 vote
+1 vote
+1 vote
+1 vote
+1 vote
+1 vote
+1 vote
+1 vote