Given a Binary Tree of size N, your task is to complete the function deletionBT(), that should delete a given node from the tree by making sure that tree shrinks from the bottom (the deleted not is replaced by bottommost and rightmost node).
The function takes two arguments as input, the reference pointer to the root of the binary tree and an integer Key that needed to be deleted from the tree.
There are T test cases and for each test case the function will be called separately.
For each test output will be the inorder traversal of the new tree.
10 20 L 20 30 L 30 40 L 30 50 R 40 60 L 60 70 R 70 80 L
1 2 L 1 3 R 2 4 L 2 5 R 3 6 L 3 7 R
60 70 80 30 50 20 10
4 2 5 1 7 3
Note:The Input/Ouput format and Example given are used for system's internal purpose, and should be used by a user for Expected Output only. As it is a function problem, hence a user should not read any input from stdin/console. The task is to complete the function specified, and not to write the full code.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.