When a top-down approach of dynamic programming is applied to a problem, it usually _____________

When a top-down approach of dynamic programming is applied to a problem, it usually _____________
A. Decreases both, the time complexity and the space complexity
B. Decreases the time complexity and increases the space complexity
C. Increases the time complexity and decreases the space complexity
D. Increases both, the time complexity and the space complexity
 
Answer: B
Explanation: The top-down approach uses the memoization technique which stores the previously calculated values. Due to this, the time complexity is decreased but the space complexity is increased.
 

Tìm kiếm

Back
Top