Question: 5. (20 points) Let T be a complete binary tree of height h with n- 2h leaf nodes. Each node v of this tree is

 5. (20 points) Let T be a complete binary tree of

5. (20 points) Let T be a complete binary tree of height h with n- 2h leaf nodes. Each node v of this tree is associated with a numerical value r(v). These values are given. If v is a leaf node, let A(v) denote its ancestors (including v as one of its own ancestors). Thus, A(v) contains v, its parent, its grand-parent etc. up to the root. For a pair of distinct leaf nodes u and v, let A(u, v) denote A(u) U A(v). Let f(v) = 2(p) f(u,v)p) PEA(v) pEA(u,v) (i)Give a divide-and-conquer algorithm to find max,EL f(v) where L is the set of leaf nodes; (ii)give a divide-and-conquer algorithm to find maxu,ueL f(u, v) What is the worst case complexity of your algorithm(s)? Show the recur- rence relation in each case and its solution. 5. (20 points) Let T be a complete binary tree of height h with n- 2h leaf nodes. Each node v of this tree is associated with a numerical value r(v). These values are given. If v is a leaf node, let A(v) denote its ancestors (including v as one of its own ancestors). Thus, A(v) contains v, its parent, its grand-parent etc. up to the root. For a pair of distinct leaf nodes u and v, let A(u, v) denote A(u) U A(v). Let f(v) = 2(p) f(u,v)p) PEA(v) pEA(u,v) (i)Give a divide-and-conquer algorithm to find max,EL f(v) where L is the set of leaf nodes; (ii)give a divide-and-conquer algorithm to find maxu,ueL f(u, v) What is the worst case complexity of your algorithm(s)? Show the recur- rence relation in each case and its solution

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!