Domanda di colloquio di FDM Group

What is BST? How do you delete a node in the BST?

Risposta di colloquio

Anonimo

12 ago 2019

if the node has no children, delete it and set pointer pointing to it to null if node has left child only, make grandparent point to left node, and remove the original parent node if node has 2 children, find the inorder successor (go right once, then left as far as possible), replace the original with inorder successor. if the inorder successor has a right child, make the parent of the inorder successor point to the right child