Which of following option is correct regarding dynamic programming?

(A) In dynamic programming, the output to stage n become the input to stages n+1 and n-1
(B) Bellman-Ford, 0-1 knapsack, Floyd Warshall algorithm are the dynamic programming based algorithm.
(C) Dynamic programming is faster than a greedy problem.
(D) We use a dynamic programming approach when we need an optimal solution.


Answer: (B)

Explanation: