Question: We compare two different divide and conquer algorithms for the same problem. Algorithm A: On an array of size n , the algorithm produces FOUR
We compare two different divide and conquer algorithms for the same problem.
Algorithm A: On an array of size n the algorithm produces FOUR sub arrays, each of size n performing Theta n work in the process. The time taken to combine the output of the sub problems is Theta n
Algorithm B: On an array of size n the algorithm produces THREE sub arrays, each of size n performing Theta n work in the process. The time taken to combine the output of the sub problems is Theta n
Write down the recurrences for the running time An for algorithm A and Bn for algorithm B on inputs of size n You do not need to write out the base case.
Solve for An using the master method to derive a Theta bound on worst case running time of algorithm A
Solve for Bn using the master method to derive a Theta bound on worst case running time of algorithm B
Master Method
The recurrence TnaTnbTheta nc
with base case
TTheta
has the solution
Case logbac
then TnTheta nlogba
Case logbac
then TnTheta nlogbalogn
Case logba
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
