3,343 views
0 0 votes

Which of the following statement(s) is/are correct?
P: For a dynamic programming algorithm, computing all values in a bottom-up fashion is asymptotically faster than using recursion
Q: The running time of a dynamic programming algorithm is always Θ(P) where P is the number of sub-problems.( Marks: -0.66 )

I mark only P is true.

Answer neither P and Q

2 Answers

5 5 votes
In case of DP memoization can be done at the same time complexity as bottom-up method. It's just looking at the same problem in two ways.

For a DP problem the complexity of solving the problem is given as: (#sub problems* cost of solving one subproblem).
0 0 votes

P: False. A bottom-up implementation must go through all of the subproblems and spend the time per subproblem for each. Using recursion and memoization only spends time on the subproblems that it needs. In fact, the reverse may be true: using recursion and memoization may be asymptotically faster than a bottom-up implementation.

Q: False. The running time of a dynamic program is the number of subproblems times the time per subproblem. This would only be true if the time per subproblem is O(1).

Position:
Show:

Related questions

2 2 votes
1 1 answer
168
168 views
GO Classes asked Aug 22
168 views
True or False:In every dynamic-programming solution, the asymptotic space requirement must be at least as large as the total number of distinct subproblems.True False
2 2 votes
1 1 answer
117
117 views
0 0 votes
1 1 answer
87
87 views
GO Classes asked Aug 22
87 views
An instance of Subset Sum contains:$n$ positive integersa positive target value $m$What is the running time of the standard dynamic-programming solution?$\Theta(m+n)$ $\T...
1 1 vote
1 1 answer
111
111 views
GO Classes asked Aug 22
111 views
There is an unlimited supply of three item types:$$\begin{array}{|c|cc|}\hline\text{Item} & \text{Size} & \text{Value} \\\hlineA & 1 & 2 \\B & 2 & 6 \\C & 3 & 9 \\\hline\...