Q. In dynamic programming, what is the primary advantage of using a bottom-up approach over a top-down approach?
-
A.
Easier to implement
-
B.
Less memory usage
-
C.
Faster execution time
-
D.
More intuitive
Solution
The bottom-up approach typically uses less memory than the top-down approach because it avoids the overhead of recursive calls.
Correct Answer:
B
— Less memory usage
Learn More →
Q. What is the main idea behind the dynamic programming solution for the coin change problem?
-
A.
Using a greedy algorithm to minimize coins
-
B.
Finding the maximum number of coins
-
C.
Calculating the minimum number of coins needed for each amount
-
D.
Sorting the coins in descending order
Solution
The dynamic programming solution for the coin change problem calculates the minimum number of coins needed for each amount up to the target.
Correct Answer:
C
— Calculating the minimum number of coins needed for each amount
Learn More →
Q. What is the primary disadvantage of using dynamic programming?
-
A.
It is always slower than greedy algorithms
-
B.
It requires more memory
-
C.
It cannot solve all problems
-
D.
It is difficult to implement
Solution
The primary disadvantage of using dynamic programming is that it often requires more memory to store intermediate results.
Correct Answer:
B
— It requires more memory
Learn More →
Q. Which of the following is NOT a characteristic of problems suitable for dynamic programming?
-
A.
Optimal substructure
-
B.
Overlapping subproblems
-
C.
Greedy choice property
-
D.
All of the above
Solution
The greedy choice property is not a characteristic of problems suitable for dynamic programming; it is a characteristic of greedy algorithms.
Correct Answer:
C
— Greedy choice property
Learn More →
Showing 1 to 4 of 4 (1 Pages)