Unit summary

  • Divide and conquer splits, solves and combines; recurrences are solved by the Master theorem.
  • Binary search is Θ(log n); max-min takes 3n/2 − 2 comparisons; merge sort is Θ(n log n) and stable; quick sort is Θ(n log n) on average and Θ(n²) worst.
  • Strassen multiplies matrices with 7 sub-products in Θ(n^2.81).
  • Any comparison sort needs Ω(n log n) comparisons (decision tree with n! leaves).
  • Greedy algorithms choose locally best options: fractional knapsack, Prim, Kruskal and Dijkstra.
  • Prim and Kruskal find MSTs; Dijkstra finds shortest paths with non-negative weights.

Glossary

Term Meaning
Cut property Lightest crossing edge is in some MST.
Decision tree Model of a comparison algorithm.
Divide and conquer Split, solve recursively, combine.
Fractional knapsack Knapsack allowing parts of items.
Greedy choice Locally best selection.
Minimum spanning tree Spanning tree of least weight.
Partition Rearranging around a pivot.
Pivot Element around which quick sort partitions.
Relaxation Improving a distance estimate.
Spanning tree Connected acyclic subgraph on all vertices.
Stable Equal keys keep input order.
Strassen Matrix multiplication with 7 sub-products.
Union-find Structure for detecting cycles.

Question bank

Short Answer Questions (2 marks each)

  1. State the three steps of divide and conquer.
  2. Write the recurrence of binary search.
  3. How many comparisons does max-min need for n = 16?
  4. Why is merge sort stable?
  5. When does quick sort give its worst case?
  6. How many multiplications does Strassen use?
  7. State the lower bound for comparison sorting.
  8. What is the greedy-choice property?
  9. How many edges does an MST of V vertices have?
  10. When does Dijkstra's algorithm fail?

Medium Answer Questions (5 marks each)

  1. Explain binary search and derive its complexity.
  2. Explain merge sort with an example.
  3. Explain quick sort and its best and worst cases.
  4. Explain Strassen's matrix multiplication.
  5. Solve the fractional knapsack for given items.
  6. Compare Prim's and Kruskal's algorithms.

Long Answer Questions (15 marks each)

  1. Explain the divide and conquer method; analyse binary search, max-min, merge sort and quick sort.
  2. Explain Strassen's algorithm and prove the Ω(n log n) lower bound for comparison sorting.
  3. Explain the greedy method with the fractional knapsack problem and Prim's and Kruskal's algorithms with an example.
  4. Explain Dijkstra's algorithm with an example and analyse its complexity.

Sources

  • Official BCA syllabus Design and Analysis of Algorithms, course code 26BCA404DS03, Unit II