Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started