subject

Suppose you are choosing between the following three algorithms: 1) Algorithm A solves problems by dividing them into five subproblems of half the size, recursively solving each subproblem, and then combining the solutions in linear time.
2) Algorithm B solves problems of size n by recursively solving two subproblems of size n - 1 and then combining the solutions in constant time.
3) Algorithm C solves problems of size n by dividing them into nine subproblems of size n/3, recursively solving each subproblem, and then combining the solutions in O(n^2) time.
What are the running times of each of these algorithms (in big-O notation), and which would you choose?
a) This is a case of the Master theorem with a = 5, b = 2, d = 1. As a > b^d, the running time is O(n^logb a) = O(n^log2 5) = O(n^2.33).
b) T(n) = 2T(n−1)+C, for some constant C. T(n) can then be expanded to C * the summation from i = 0 to n−1 2^i+2^n * T(0) = O(2^n).
c) This is a case of the Master theorem with a = 9, b = 3, d = 2. As a = b^d, the running time is O(n^d log n) = O(n^2 log n).

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 24.06.2019 01:30
Write a program that asks the user to enter the name of an input file. if the file does not exist, the program should prompt the user to enter the file name again. if the user types quit in any uppercase/lowercase combinations, then the program should exit without any further output.
Answers: 3
question
Computers and Technology, 24.06.2019 12:00
An npn transistor is correctly biased and turned on if the a. base is negative. b. collector is negative. c. collector is positive with respect to the emitter and negative with respect to the base. d. collector is the most positive lead followed by the base.
Answers: 1
question
Computers and Technology, 24.06.2019 21:30
The hybrid uses 144 to 158 volt batteries.
Answers: 1
question
Computers and Technology, 24.06.2019 23:30
Does anyone have the problem where you try to watch a video to get your answer but it brings up a thing asking your gender to make ads relevant but it doesn't load? btw i won't be able to see the answer so use the comments .
Answers: 1
You know the right answer?
Suppose you are choosing between the following three algorithms: 1) Algorithm A solves problems by...
Questions
question
Mathematics, 21.05.2020 20:05
question
Mathematics, 21.05.2020 20:05
question
Spanish, 21.05.2020 20:05
Questions on the website: 13722359