Unit 3: Greedy Method - Subjective Questions

ECAP538 • Practice Questions with Detailed Answers

20 questions

1

Define the greedy method. State the main components required to design a greedy algorithm.

2

Explain the greedy-choice property and optimal substructure with suitable examples.

3

Describe the general steps used to develop and prove the correctness of a greedy algorithm.

4

Distinguish between greedy algorithms and dynamic programming.

5

Formulate the fractional knapsack problem mathematically and describe its greedy solution.

6

Solve the fractional knapsack problem for capacity and items equal to , , and . Show all steps.

7

Why does the greedy strategy solve fractional knapsack optimally but not necessarily the knapsack problem? Give a counterexample.

8

Define a minimum spanning tree and state its important properties.

9

Explain the cut property and cycle property used in minimum spanning tree algorithms.

10

Describe Prim's algorithm for constructing a minimum spanning tree and analyze its time complexity.

11

Apply Prim's algorithm starting at vertex to the graph with weighted edges , , , , , and , . Find the MST and its cost.

12

Describe Kruskal's algorithm and explain how the disjoint-set data structure supports it.

13

Apply Kruskal's algorithm to the graph with edges , , , , , , and . Show the component changes and find the MST cost.

14

Compare Prim's and Kruskal's minimum spanning tree algorithms.

15

What happens when Prim's or Kruskal's algorithm is applied to a disconnected graph? Explain the concept of a minimum spanning forest.

16

Define the single-source shortest-path problem and distinguish a shortest-path tree from a minimum spanning tree.

17

Explain Dijkstra's greedy algorithm for the single-source shortest-path problem and analyze its complexity.

18

Apply Dijkstra's algorithm from source to the directed graph with edges , , , , , and . Find all shortest distances and paths.

19

Why does Dijkstra's algorithm require nonnegative edge weights? Illustrate its failure using an example.

20

Prove the correctness of Dijkstra's algorithm for graphs with nonnegative edge weights.