Semester Exam Questions – Algorithms
Unit 1: Algorithm Correctness & Complexity Analysis
Q1. Define an algorithm. State and explain the five essential properties every algorithm must
satisfy.
Q2. Compare Algorithm A1: 50n log n and Algorithm A2: 2n² on a PC (10■ ins/sec) and
Supercomputer (10■ ins/sec). Which runs faster? Show calculations.
Q3. Explain the difference between testing and correctness proof. Why is testing alone dangerous?
Q4. Prove correctness of the recursive Fibonacci number algorithm using mathematical induction.
Q5. Prove correctness of the recursive maximum-finding algorithm using induction.
Q6. Prove correctness of the recursive multiplication algorithm multiply(y, z).
Q7. Derive the time complexity of the binary multiplication algorithm (shift-and-add method).
Q8. Derive and prove the worst-case complexity of Bubble Sort.
Q9. State and prove that log n = O(n).
Q10. Solve the following recurrence relations (any 2): T(n) = 2T(n/2) + 6n, T(n) = 3T(n/3) + 6n – 9,
T(n) = 2T(n/3) + 5n, T(n) = 4T(n/2) + n, T(n) = 3T(n/2) + 9n.
Unit 2: Divide & Conquer – 1
Q11. Using Divide & Conquer, derive the minimum number of comparisons required to find both
maximum and minimum in an array of size n. Prove correctness by induction.
Q12. Show that the Divide & Conquer Max–Min algorithm uses 1.5n – 2 comparisons in the worst
case.
Q13. Compare naïve multiplication (O(n²)) with Karatsuba’s Divide & Conquer multiplication
algorithm (O(n^1.59)). Explain the improvement.
Q14. Derive the recurrence relation for Divide & Conquer multiplication. Solve it using recurrence
theorem.
Q15. Prove the correctness of Divide & Conquer multiplication.
Q16. Write the algorithm for naïve matrix multiplication and analyze its time complexity.
Q17. Derive the recurrence for Divide & Conquer matrix multiplication (8T(n/2) + dn²). Solve it.
Q18. Explain Strassen’s matrix multiplication algorithm with all steps.
Q19. Derive the recurrence for Strassen’s algorithm (T(n) = 7T(n/2) + dn²) and solve for time
complexity.
Q20. Perform matrix multiplication of size 32x32, 128x128, 256x256, 512x512 using Strassen’s
algorithm and Naïve algorithm, and prepare a comparative table.
Unit 3: Divide & Conquer – 2
Q21. Explain the Divide & Conquer Selection algorithm for finding the k-th smallest element. Prove
correctness.
Q22. Derive and prove the average-case complexity of Selection algorithm. Why is it O(n)?
Q23. What is the worst-case complexity of the Selection algorithm? Compare with Quicksort.
Q24. Write the recursive Binary Search algorithm. Derive and prove its time complexity.
Q25. Prove correctness of Binary Search by induction.
Q26. Derive the recurrence relation for Binary Search and solve it.
Q27. Write the recursive solution for the Tower of Hanoi problem. Derive recurrence T(n) = 2T(n-1)
+ 1 and solve it.
Q28. Calculate the number of moves required for Tower of Hanoi with 64 disks at 1 move/second.
Compare with age of the universe.
Q29. Prove correctness of Tower of Hanoi algorithm using induction.
Q30. Explain the non-recursive Tower of Hanoi algorithm (monks’ clockwise/anticlockwise
strategy). Prove equivalence with recursive method.