Quiz
Quiz
6 Wrong
Question 1 (10 points)
Saved
Dynamic programming have in common with divide-and-
conquer, where both techniques solve a problem by adding it
into several subproblems. But smaller subproblems in divide-
and-conquer do not overlap; therefore their solutions are
stored for reuse.
Question 1 options:
True
False
Question 2 (10 points)
Saved
Kruskal’s algorithm work correctly on graphs that have
negative edge weights?
Question 2 options:
True
False
Question 3 (10 points)
Saved
Dynamic programming can be used for constructing an
optimal binary search tree for a given set of keys and known
probabilities of searching for them.
Question 3 options:
True
False
Question 4 (10 points)
Saved
Indicate whether each of the following properties are true for
every Huffman code.
a. The codeword’s length of a more frequent character is
always smaller than or equal to the codeword’s length of a
less frequent one.
Question 4 options:
True
False
Question 5 (10 points)
Saved
Applicability of dynamic programming to an optimization
problem requires the problem to satisfy the principle of
optimality?
Question 5 options:
True
False
Question 6 (10 points)
Saved
The root of an optimal binary search tree always contains the
key with the highest search probability?
Question 6 options:
True
False
Question 7 (10 points)
Saved
The performance ratio is the principal metric for measuring
the accuracy of approximation algorithms.
Question 7 options:
True
False
Question 8 (10 points)
Saved
A game of chess can be posed as the following decision
problem: given a legal positioning of chess pieces and
information about which side is to move, determine whether
that side can win. Is this decision problem decidable?
Question 8 options:
True
False
Question 9 (10 points)
Saved
Dynamic programming suggests solving each smaller
subproblem once and recording the results in a table from
which a solution to the original problem can be then obtained.
Question 9 options:
True
False
Question 10 (10 points)
Saved
The notion of a minimum spanning tree is applicable to a
connected weighted graph. Do we have to check a graph’s
connectivity before applying Prim’s algorithm.
Question 10 options:
True
False
Question 11 (10 points)
Saved
Does the greedy algorithm always yield an optimal solution?
Question 11 options:
True
False
Question 12 (10 points)
Saved
The 0-1 version of the knapsack problem cannot be solved by
the simplex method because of the integrality (0-1)
constraints imposed on the problem’s variables.
Question 12 options:
True
False
Question 13 (10 points)
Saved
Indicate whether each of the following properties are true for
every Huffman code.
a. The codewords of the two least frequent characters have
the same length.
Question 13 options:
True
False
Question 14 (10 points)
Saved
Any comparison-based algorithm will need at least 2n
comparisons to merge two arbitrary sorted lists of sizes 3n
and 2n +1, respectively. The proof is obtained via the
adversary argument similar to the one given in the section for
the case of two n-element lists.
Question 14 options:
True
False
Question 15 (10 points)
Saved
A sequence of values in a row of the dynamic programming
table for the knapsack problem is always nondecreasing.
Question 15 options:
True
False
Question 16 (10 points)
Saved
A sequence of values in a column of the dynamic
programming table for the knapsack problem is always
nondecreasing?
Question 16 options:
True
False
Question 17 (10 points)
Saved
P is the class of all decision problems that can be solved in
polynomial time. NP is the class of all decision problems
whose randomly guessed solutions can be verifies in
polynomial time.
Question 17 options:
True
False
Question 18 (10 points)
Saved
With the book’s definition of the transitive closure (which
considers only nontrivial paths of a digraph), a digraph has a
directed cycle if and only if its transitive closure has a 1 on its
main diagonal. The algorithm that finds the transitive closure
by applying Warshall’s algorithm and then checks the
elements of its main diagonal is cubic. This is inferior to the
quadratic algorithms for checking whether a digraph
represented by its adjacency matrix is a dag.
Question 18 options:
True
False
Question 19 (10 points)
Saved
T
Question 19 options:
True
False
Question 20 (10 points)
Saved
Prim’s algorithm does work correctly on graphs with negative
edge weights.
Question 20 options:
True
False
Question 21 (10 points)
Saved
The continuous version of the knapsack problem can be
solved by the simplex method, because it is a special case of
the general linear programming problem
Question 21 options:
True
False
Question 22 (10 points)
Saved
We can generate the codewords right to left by the following
method that stems immediately from Huffman’s algorithm:
when two trees are combined, append 0 in front of the current
bit strings for each leaf in the left subtree and append 1 in
front of the current bit strings for each leaf in the right
subtree. (The substrings associated with the initial one-node
trees are assumed to be empty.)
Question 22 options:
True
False
Question 23 (10 points)
Saved
Let T be a tree constructed by Dijkstra’s algorithm in the
process of solving the single-source shortest-path problem for
a weighted connected graph G.
. True or false: T is a spanning tree of G?
Question 23 options:
True
False
Question 24 (10 points)
Saved
Will the backtracking algorithm work correctly if we use just
one of the two inequalities to terminate a node as
nonpromising?
Question 24 options:
True
False
Question 25 (10 points)
Saved
Let T be a tree constructed by Dijkstra’s algorithm in the
process of solving the single-source shortest-path problem for
a weighted connected graph G.
True or false: T is a minimum spanning tree of G?
Question 25 options:
True
False
Question 26 (10 points)
Saved
It is a good idea to apply Warshall’s algorithm to find the
transitive closure of an undirected graph?
Question 26 options:
True
False
Question 27 (10 points)
Saved
The adversary method for establishing lower bounds is based
on following the logic of a malevolent adversary who forces
the algorithm into the most time-consuming path.
Question 27 options:
True
False
Question 28 (10 points)
Saved
Approximation algorithms are often used to find approximate
solutions to difficult problems of combinatorial optimization.
Question 28 options:
True
False
Question 29 (10 points)
Saved
A principal difference between Dynamic programming and
divide-and-conquer is that Smaller subproblems in dynamic
programming do overlap; therefore their solutions are stored
for reuse.
Question 29 options:
True
False
Question 30 (10 points)
Saved
Question: What data structure would you use to keep track of
live nodes in a best-first branch-and-bound algorithm?
Answer: The heap and min-heap for maximization and
minimization problems, respectively.
Question 30 options:
True
False