Question: Given the following algorithm, use the master method to find the runtime of the algorithm within a polylog factor of the exact runtime. Then create
Given the following algorithm, use the master method to find the runtime of the algorithm within a polylog factor of the exact runtime. Then create a recursion tree in order to create a more accurate guess of what the exact runtime should be. Finally use the substitution method to prove that your guess is correct.
Alg(A, n)
-
if n 3
-
return array
-
for i = 0 to n
-
A[i] = A[n i]
-
return Alg(A[1 ... n], n)Alg(A[n + 1 ... 2n], n)Alg(A[2n + 1 ... n], n)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
