Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.

Unit 5 subjective questions More on Dynamic Programming

ECAP538 20 questions with model answers. Write yours first, then compare.

Read the notes Practice MCQs
  1. Question 1 of 20

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

  2. Question 2 of 20

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

  3. Question 3 of 20

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

  4. Question 4 of 20

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

  5. Question 5 of 20

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

  6. Question 6 of 20

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

  7. Question 7 of 20

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

  8. Question 8 of 20

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

  9. Question 9 of 20

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

  10. Question 10 of 20

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

  11. Question 11 of 20

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

  12. Question 12 of 20

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

  13. Question 13 of 20

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

  14. Question 14 of 20

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

  15. Question 15 of 20

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

  16. Question 16 of 20

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

  17. Question 17 of 20

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

  18. Question 18 of 20

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

  19. Question 19 of 20

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

  20. Question 20 of 20

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

That's unit 5

Long answers stick best when they're tested again soon. Run the MCQs on this unit, then come back to the questions you found hardest.