Question: Write a recurrence relation describing the worst case running time of each of the following algorithms and determine the asymptotic complexity of the function
Write a recurrence relation describing the worst case running time of each of the following algorithms and determine the asymptotic complexity of the function defined by the recurrence relation. Justify your solution using either expansion, a recursion tree or substitution method. You may NOT use the Master theorem. Assume that all arithmetic operations take constant time. Simplify and express your answer as O(n) or (n* (log n)) wherever possible. If the algorithm takes exponential time, then just give exponential lower bounds. 11. Func11(A, n) /* A = array of n integers 1 if n < 20 then 2 3 4 5 x < 0; for i 1 to n do |x + x + A[i]; end return (r); 6 7 end 8 for 1 to 3 do 9 10 11 12 13 end 14 return (r); Func11(A, [n/3]); for j2n to 2n + 10 do |x + x + A[i]; end
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
