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)
- State the three steps of divide and conquer.
- Write the recurrence of binary search.
- How many comparisons does max-min need for n = 16?
- Why is merge sort stable?
- When does quick sort give its worst case?
- How many multiplications does Strassen use?
- State the lower bound for comparison sorting.
- What is the greedy-choice property?
- How many edges does an MST of V vertices have?
- When does Dijkstra's algorithm fail?
Medium Answer Questions (5 marks each)
- Explain binary search and derive its complexity.
- Explain merge sort with an example.
- Explain quick sort and its best and worst cases.
- Explain Strassen's matrix multiplication.
- Solve the fractional knapsack for given items.
- Compare Prim's and Kruskal's algorithms.
Long Answer Questions (15 marks each)
- Explain the divide and conquer method; analyse binary search, max-min, merge sort and quick sort.
- Explain Strassen's algorithm and prove the Ω(n log n) lower bound for comparison sorting.
- Explain the greedy method with the fractional knapsack problem and Prim's and Kruskal's algorithms with an example.
- 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
