Question: T: Binary Tree node; T.left and T.right: pointers to the left and right children of node T. Mystery (T: Binary Tree Root Node) 1. if
T: Binary Tree node; T.left and T.right: pointers to the left and right children of node T.
Mystery (T: Binary Tree Root Node)
1. if T.left == NULL and T.right == NULL then return 0
2. if T.left != NULL and T.right != NULL then
3. return Larger(Mystery(T.left), Mystery(T.right)) + 1 //Larger(x,y) returns larger of x and y
4. if T.left != NULL then return Mystery(T.left)+1
5. if T.right != NULL then return Mystery(T.right)+1
What does Mystery compute?
Step by Step Solution
There are 3 Steps involved in it
The function Mystery is recursively determining a certain property of a binary tree starting from th... View full answer
Get step-by-step solutions from verified subject matter experts
