Chapter 3: Algorithm Design Techniques and Strategies
Question 1
Which of the following options will be correct when a top-down approach of dynamic programming is applied to solve a given problem related to the space and time complexity?
- It will increase both time and space complexity
- It will increase the time complexity, and decrease the space complexity
- It will increase the space complexity, and decrease the time complexity
- It will decrease both time and space complexities
Solution
Option c is correct.
Since the top-down approach of dynamic programming uses the memoization technique, which stores the pre-calculated solution of a subproblem. It avoids recalculation of the same subproblem that decreases the time complexity, but at the same time, the space complexity will increase because of storing the extra solutions of the subproblems.
Question 2
What will be the sequence of nodes in the following edge-weighted directed graph...