Unit 5: More on Dynamic Programming - Subjective Questions

ECAP538 • Practice Questions with Detailed Answers

20 questions

1

Define the all-pairs shortest-path problem. What output is expected, and which edge-weight conditions must be considered?

2

Explain the optimal substructure used in dynamic-programming solutions to the all-pairs shortest-path problem.

3

Derive the dynamic-programming recurrence used by the Floyd-Warshall algorithm.

4

Describe the Floyd-Warshall algorithm, justify the order of its loops, and analyze its time and space complexity.

5

How is the distance matrix initialized for Floyd-Warshall? Explain the handling of absent edges, self-loops, parallel edges, and negative edges.

6

Explain how an actual shortest path can be reconstructed after running Floyd-Warshall.

7

How does Floyd-Warshall detect negative-weight cycles, and what is their effect on shortest-path results?

8

Compare Floyd-Warshall with repeated applications of Dijkstra's and Bellman-Ford algorithms for solving all-pairs shortest paths.

9

Explain the matrix-multiplication formulation of all-pairs shortest paths using the min-plus product.

10

Apply Floyd-Warshall to a directed graph with edges , , , , , , and . Give the final distance matrix.

11

Define an optimal binary search tree and state the objective optimized by it.

12

Distinguish between successful and unsuccessful search probabilities in the optimal binary search tree problem.

13

Explain how the expected search cost of a binary search tree is calculated.

14

Derive the dynamic-programming recurrence for constructing an optimal binary search tree.

15

Describe the base cases and table-filling order required by the dynamic-programming algorithm for optimal binary search trees.

16

Present the standard dynamic-programming algorithm for an optimal binary search tree and analyze its complexity. How is the tree reconstructed?

17

Construct an optimal binary search tree for three keys with , , and , , , . Give its expected cost.

18

Explain Knuth's optimization for the optimal binary search tree problem.

19

Compare an optimal binary search tree with a height-balanced binary search tree and a Huffman tree.

20

Discuss the assumptions, applications, and limitations of optimal binary search trees.