Design and Analysis of Algorithms Exam 2024 25
Design and Analysis of Algorithms Exam 2024 25
Instructions:
SECTION A (2 × 10 = 20 Marks)
(b) Solve the recurrence: T(n) = 2T(floor(n/2)) + n using the Master Theorem.
(g) Explain the steps of Kruskal's algorithm to find the Minimum Spanning Tree.
2. (a) Solve the recurrence T(n) = T(n/3) + T(2n/3) + n using the Recursion Tree method.
(b) Insert the following elements into an initially empty B-Tree of degree t = 2:
15, 8, 30, 5, 20, 25, 10, 12, 40, 35. Then delete 12 and 25.
(c) Write Kruskal's algorithm. Use it to find the Minimum Spanning Tree of the following graph:
(d) Write and explain the algorithm for the Longest Common Subsequence (LCS).
(e) Explain Heap Sort. Sort the array A = [20, 5, 15, 10, 25, 30, 12] using Heap Sort.
3. (a) Apply the Floyd-Warshall Algorithm to find the All-Pairs Shortest Paths for the following graph:
(b) Solve the Knapsack Problem for W = 50, with the following data using the Greedy approach:
- Items: 1, 2, 3, 4
(c) Compare Backtracking and Branch-and-Bound methods. Solve the Subset Sum Problem using
Backtracking.
(d) Define the Convex Hull problem. Explain and apply the Graham Scan algorithm for the
following points:
(0, 3), (1, 1), (2, 2), (4, 4), (0, 0), (1, 2), (3, 1), (3, 3).
(f) Explain the KMP Algorithm. Compute the prefix function for the pattern P = 'aabac' and find its
occurrence in T = 'aaabaacaba'.