Question: Your lecturer is a funny guy; given a sorted list of numbers, he will use the following recursive search algorithm to search the smallest number:
Your lecturer is a funny guy; given a sorted list of numbers, he will use the following
recursive search algorithm to search the smallest number:
Question 2 (10 marks) Your lecturer is a funny guy; given a sorted list of numbers, he will use the following recursive search algorithm to search the smallest number: static int mininum (L,left, right) if (left == right) then return L[left] else temp1 + minimum(L,left,(left + right)/2) temp2 + minimum(L, ((left + right)/2) +1, right) if templ Stemp2 return temp1 else return temp2 (a) Analyse the worst-case asymptotic complexity of the algorithm your lecturer uses. Give the worst-case running time in terms of notation. Explain your answer. (6 marks) (b) How does this algorithm compare to the algorithm that simply linearly iterates through the list to look for the target? Explain your answer. (Hint: Tricky, do not get mis-led by the question.) (4 marks)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
