+ 1
Wap to delete an user input node of a binary tree if it is a leaf node
input : A binary tree. And a number. output : if possible print number otherwise "not possible".
6 Respostas
+ 1
The title and the description is ambigious.
Would you please clarify?
+ 1
Suppose you have a binary tree and you want to delete a node(containing the data which is user-input) from it. Condition, if it is the leaf node, delete it else print "not possible" and if the data not present in the tree print "data not exist".
+ 1
Is the tree ordered? (in a different form: is it a binary search tree)
+ 1
If it is ordered, then simply search for the value and if the value has no children, delete (and print number). If it has any, don't delete (and print "not possible")
it is the same for an unordered, ordinary binary tree. The only difference would be in the searching algorithm.
0
it's a binary tree.
0
Thanks