Question: 4 ) Recursive Analysis HomeworkUnanswered The following algorithm takes an unsorted list of positive integers, along with two integers and . It returns the largest

4) Recursive Analysis
HomeworkUnanswered
The following algorithm takes an unsorted list of positive integers, along with two integers and .It returns the largest number, , in the list such that either or is true. It returns 0 if no such exists. The algorithm assumes that the list size, , is a power of 2 with .(Recall that the function is known as floor and might be written in text mode as floor(x).)
1 : integer xyMax(x, y,{a_0, a_1,..., a_{n-1}})2 : if n ==13 : if (a_0^x == y) or (a_0^y == x)4 : return a_05 : else 6 : return 07 : 8 : # process the left half 9 : 10 : m_1= xyMax(x,y,{a_0,..., a_{floor(n/2)-1}})11 : 12 : # process the right half 13 : 14 : m_2= xyMax(x,y,{a_{floor(n/2)},..., a_{n-1}})15 : 16 : # find the largest 17 : 18 : max = m_119 : if (m_2> max)20 : max = m_221 : 22 : return max 23 : end xyMax
What is the recurrence relation that counts the number of comparisons for this algorithm?
What is a good big- reference function for algorithm xyMax? (Hint: Which Master Theorem applies here?)

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 Programming Questions!