Suppose you are choosing between the following three algorithms: Algorithm A sol
ID: 3932782 • Letter: S
Question
Suppose you are choosing between the following three algorithms: Algorithm A solves problems by dividing them into five sub problems of half the size, recursively solving each sub problem, and then combining the solutions in linear time. Algorithm B solves problems of size n by recursively solving two sub problems of size n 1 and then combining the solutions in constant time. Algorithm C solves problems of size n by dividing them into nine sub problems of size n/3, recursively solving each sub problem, and then combining the solutions in theta(n^2) time. Which would you choose? Explain.Explanation / Answer
We do not pick algorithm 3 as it takes too long to combine the solution.
Splitting into 2 subproblems takes less time than 5 sub problems since the combining is constant for both. Thus algorithm A.
Although this is greatly dependent on the side of data, splitting time and recombining time.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.