Write an algorithm for deletion of an element from BST. ( Include all cases).
Answers
Answered by
1
Answer:
Step 1: IF TREE = NULL. Write "item not found in the tree" ELSE IF ITEM < TREE -> DATA. Delete(TREE->LEFT, ITEM) ELSE IF ITEM > TREE -> DATA. Delete(TREE -> RIGHT, ITEM) ELSE IF TREE -> LEFT AND TREE -> RIGHT. SET TEMP = findLargestNode(TREE -> LEFT) SET TREE -> DATA = TEMP -> DATA. ...
Step 2: END.
Similar questions