Answered step by step
Verified Expert Solution
Question
1 Approved Answer
4. Consider an algorithm that works as follows: Starting with an input of size n, it divides the input into two or more groups, solves
4. Consider an algorithm that works as follows: Starting with an input of size n, it divides the input into two or more groups, solves each group separately, and then combines the answers from each group to form its output. Suppose the algorithm creates k groups of sizes n1,,nk. Then it takes the algorithm O(nilogni) time to solve the i th group whose size is ni and O(n+k) time to divide the input into k groups and combine the partial results to generate the output. a. (5 pts.) Determine an upper bound on the running time of the whole algorithm in terms of n. Note that k and the ni 's are not fixed values but depend instead on the input. b. (5 pts.) Now redo the question when it takes the algorithm O(ni3) time to solve the i th group of size ni and O(n2+k) time to divide the input into k groups and assemble the partial results to form the output
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