B.E./[Link].
DEGREE EXAMINATIONS, NOVEMBER 2025
Fourth Semester
Computer Science and Engineering
CS 3401 — ALGORITHMS
Time: Three hours Maximum: 100 marks
Note: Answer ALL questions.
PART A - (10 × 2 = 20 marks)
Unit I: Introduction
1. Define O, Ω, and Θ notations with examples.
2. Why is binary search preferred over linear search for large datasets?
Unit II: Graph Algorithms
3. List two applications of DFS and BFS.
4. What is the key difference between Prim’s and Kruskal’s MST algorithms?
Unit III: Algorithm Design Techniques
5. State the master theorem for divide-and-conquer recurrences.
6. Give an example where greedy algorithms fail to deliver optimal solutions.
Unit IV: State Space Search Algorithms
7. How does backtracking prune the state space tree?
8. Why is branch-and-bound suitable for the Traveling Salesman Problem?
Unit V: NP-Complete and Approximation Algorithms
9. Define NP-hardness with an example.
10. What is the role of randomization in quicksort?
PART B - (5 × 13 = 65 marks)
11. (a) Derive the time complexity of merge sort using recursion tree method.
OR
(b) Explain the Knuth-Morris-Pratt (KMP) string matching algorithm with an example.
12. (a) Find the shortest path from vertex A to all other vertices using Dijkstra’s algorithm for the given graph.
OR
(b) Construct an MST using Kruskal’s algorithm step-by-step.
13. (a) Solve the matrix chain multiplication problem for matrices with dimensions [5×4, 4×6, 6×2, 2×7].
OR
(b) Design a Huffman code for the characters {A: 25%, B: 15%, C: 20%, D: 10%, E: 30%}.
14. (a) Solve the subset sum problem for S = {2, 4, 6, 8} and target d = 10 using backtracking.
OR
(b) Apply branch-and-bound to solve the 0/1 knapsack problem with items {(2, 3), (3, 4), (4, 5), (5, 6)} and W = 5.
15. (a) Prove that the 3-CNF-SAT problem is NP-complete.
OR
(b) Explain the Miller-Rabin primality test with an example.
PART C - (1 × 15 = 15 marks)
16. (a) Execute the Bellman-Ford algorithm on the following graph and show the distance updates after each iterati
OR
(b) Illustrate the dynamic programming solution for the Travelling Salesman Problem (TSP) for 4 cities.