1.

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 deletedii)iii) delete the node atwhat 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 nodeEnquiry is from Binary Trees using Linked Lists in chapter Binary Trees of Data Structures & Algorithms IThe question was asked during an online interview.

Answer»

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.



Discussion

No Comment Found

Related InterviewSolutions