Q. In dynamic programming, what does the term 'state' refer to?
-
A.
The current value of a variable
-
B.
A specific subproblem
-
C.
The final solution
-
D.
The input size
Solution
In dynamic programming, a 'state' refers to a specific subproblem that is being solved.
Correct Answer:
B
— A specific subproblem
Learn More →
Q. What is the space complexity of the dynamic programming solution for the edit distance problem?
-
A.
O(n)
-
B.
O(m)
-
C.
O(n * m)
-
D.
O(1)
Solution
The space complexity of the dynamic programming solution for the edit distance problem is O(n * m), where n and m are the lengths of the two strings.
Correct Answer:
C
— O(n * m)
Learn More →
Q. Which of the following algorithms uses dynamic programming to solve the problem of finding the shortest path in a weighted graph?
-
A.
Dijkstra's Algorithm
-
B.
Bellman-Ford Algorithm
-
C.
A* Search
-
D.
Depth-First Search
Solution
The Bellman-Ford Algorithm uses dynamic programming to find the shortest path in a weighted graph, especially when negative weights are present.
Correct Answer:
B
— Bellman-Ford Algorithm
Learn More →
Showing 1 to 3 of 3 (1 Pages)