Algorithms Final Questions With Answers
Question 1.
Correct Answer:
Question 2.
All decidable problems are tractable.
Correct Answer: False
Question 3.
All computational problems are decidable if provide unlimited computational resources.
Correct Answer: False
Question 4.
A non-deterministic polynomial algorithm contains a guess step, and a polynomial time
verification step.
Correct Answer: True
Question 5.
A problem is NP-hard if it at least NP-complete.
Correct Answer: True
Question 6.
Both 3SAT and set cover problems are NP-complete.
Correct Answer: True
Question 7.
In NP-completeness, the "NP" stands for Non-Polynomial.
Correct Answer: True
Question 8.
If one NP-complete problem is tractable, then all NP-complete problems are tractable.
Correct Answer: True
Question 9.
One should not try to solve any NP-hard problems because they are rarely appear in real
world applications.
Correct Answer: False
Question 10.
One may apply both greedy and dynamic programming to tackle NP-hard problems for
approximated solutions.
Correct Answer: True
Question 11.
There are definitely no polynomial algorithms to solve any NP-hard problem.
Correct Answer: False
,Question 12.
To prove a problem is NP-hard, one only need to show it is at least NP-complete.
Correct Answer: True
Question 13.
Both paradigms of divide-and-conquer and dynamic programming need to solve
sub-problems to obtain a solution.
Correct Answer: True
Question 14.
Both paradigms of divide-and-conquer and dynamic programming solve a problem
top-down.
Correct Answer: False
Question 15.
Sub-problems in divide-and-conquer have no overlap. But, there are overlapped
sub-problems in DP.
Correct Answer: True
Question 16.
Algorithms developed with dynamic programming paradigm can be illustrated as branch
trees
Correct Answer: False
Question 17.
Algorithms developed with dynamic programming paradigm may be illustrated as a dag
in its topological order.
Correct Answer: True
Question 18.
Dynamic programming is a top-down paradigm in algorithm development.
Correct Answer: False
Question 19.
With dynamic programming, one may solve some initially looks like intractable problems
in simple code.
Correct Answer: True
Question 20.
The graph below on the left is a DAG. The graph on the right linearizes the DAG in its
topological order. To find shortest paths from S in the graph with dynamic programming,
it is better to use the graph on the right.
Correct Answer: True
,Question 21.
Provided a sequence: A = (5, 2, 8, 6, 3, 6, 7, 9). The longest decreasing subsequence
ended at 3 depends on the lengths of decreasing subsequences ended at 5, 8, and 6,
respectively.
Correct Answer: True
Question 22.
Let x[1,2, ... , i] and y[1, 2, ..., j] be two strings. Then, the edit distance between x and y is
E(i,j) = 1 + min { E(i-1, j), E(i, j-1}, E(i-1, j-1)}.
Correct Answer: False
Question 23.
A greedy approach always makes the choice that looks best at the moment
Correct Answer: True
Question 24.
With greedy approach, we can always find the best solution.
Correct Answer: False
Question 25.
Let G(V, E) be a connected weighted graph with more than |V| -1 edges. If there is a
unique heaviest edge in G, then this edge cannot be a part of a minimum spanning tree
(do not make any other assumptions.)
Correct Answer: False
Question 26.
The shortest path tree obtained with Dijkstra's algorithm is also a minimum spanning tree
of the same graph.
Correct Answer: False
Question 27.
Let e be any edge of minimum weight in G. Then must be a part of every MST. (No any
other assumptions should be made.)
Correct Answer: False
Question 28.
The time complexity of Kruskal's MST algorithm is O(|E| log |E|).
Correct Answer: True
Question 29.
Both Dijkstra shortest path algorithm and Prim's MST algorithm apply greedy approach.
Correct Answer: True
Question 30.
In Huffman coding tree, all characters must be in leaf nodes.
Correct Answer: True
Question 1.
Correct Answer:
Question 2.
All decidable problems are tractable.
Correct Answer: False
Question 3.
All computational problems are decidable if provide unlimited computational resources.
Correct Answer: False
Question 4.
A non-deterministic polynomial algorithm contains a guess step, and a polynomial time
verification step.
Correct Answer: True
Question 5.
A problem is NP-hard if it at least NP-complete.
Correct Answer: True
Question 6.
Both 3SAT and set cover problems are NP-complete.
Correct Answer: True
Question 7.
In NP-completeness, the "NP" stands for Non-Polynomial.
Correct Answer: True
Question 8.
If one NP-complete problem is tractable, then all NP-complete problems are tractable.
Correct Answer: True
Question 9.
One should not try to solve any NP-hard problems because they are rarely appear in real
world applications.
Correct Answer: False
Question 10.
One may apply both greedy and dynamic programming to tackle NP-hard problems for
approximated solutions.
Correct Answer: True
Question 11.
There are definitely no polynomial algorithms to solve any NP-hard problem.
Correct Answer: False
,Question 12.
To prove a problem is NP-hard, one only need to show it is at least NP-complete.
Correct Answer: True
Question 13.
Both paradigms of divide-and-conquer and dynamic programming need to solve
sub-problems to obtain a solution.
Correct Answer: True
Question 14.
Both paradigms of divide-and-conquer and dynamic programming solve a problem
top-down.
Correct Answer: False
Question 15.
Sub-problems in divide-and-conquer have no overlap. But, there are overlapped
sub-problems in DP.
Correct Answer: True
Question 16.
Algorithms developed with dynamic programming paradigm can be illustrated as branch
trees
Correct Answer: False
Question 17.
Algorithms developed with dynamic programming paradigm may be illustrated as a dag
in its topological order.
Correct Answer: True
Question 18.
Dynamic programming is a top-down paradigm in algorithm development.
Correct Answer: False
Question 19.
With dynamic programming, one may solve some initially looks like intractable problems
in simple code.
Correct Answer: True
Question 20.
The graph below on the left is a DAG. The graph on the right linearizes the DAG in its
topological order. To find shortest paths from S in the graph with dynamic programming,
it is better to use the graph on the right.
Correct Answer: True
,Question 21.
Provided a sequence: A = (5, 2, 8, 6, 3, 6, 7, 9). The longest decreasing subsequence
ended at 3 depends on the lengths of decreasing subsequences ended at 5, 8, and 6,
respectively.
Correct Answer: True
Question 22.
Let x[1,2, ... , i] and y[1, 2, ..., j] be two strings. Then, the edit distance between x and y is
E(i,j) = 1 + min { E(i-1, j), E(i, j-1}, E(i-1, j-1)}.
Correct Answer: False
Question 23.
A greedy approach always makes the choice that looks best at the moment
Correct Answer: True
Question 24.
With greedy approach, we can always find the best solution.
Correct Answer: False
Question 25.
Let G(V, E) be a connected weighted graph with more than |V| -1 edges. If there is a
unique heaviest edge in G, then this edge cannot be a part of a minimum spanning tree
(do not make any other assumptions.)
Correct Answer: False
Question 26.
The shortest path tree obtained with Dijkstra's algorithm is also a minimum spanning tree
of the same graph.
Correct Answer: False
Question 27.
Let e be any edge of minimum weight in G. Then must be a part of every MST. (No any
other assumptions should be made.)
Correct Answer: False
Question 28.
The time complexity of Kruskal's MST algorithm is O(|E| log |E|).
Correct Answer: True
Question 29.
Both Dijkstra shortest path algorithm and Prim's MST algorithm apply greedy approach.
Correct Answer: True
Question 30.
In Huffman coding tree, all characters must be in leaf nodes.
Correct Answer: True