Question: Let T be a binary tree with n positions. Define a Roman position to be a position p in T, such that the number of
Let T be a binary tree with n positions. Define a Roman position to be a position p in T, such that the number of descendants in p’s left subtree differ from the number of descendants in p’s right subtree by at most 5. Describe a linear-time method for finding each position p of T, such that p is not a Roman position, but all of p’s descendants are Roman.
Step by Step Solution
3.45 Rating (171 Votes )
There are 3 Steps involved in it
a For each Node add property roman If it is roman Node set value to 1 else set to 0 If any Node is ... View full answer
Get step-by-step solutions from verified subject matter experts
