DAA1 Rev Test
DAA1 Rev Test
1.
2. Medium Answer Questions (5x4 = 20 Marks):
a) Compare Bubble Sort and Merge Sort in terms of time complexity for all cases.
b) Using substitution, solve the recurrence relation: T(n)=2T(n/2)+nT(n) = 2T(n/2) +
nT(n)=2T(n/2)+n.
c) Draw and explain the recursion tree for T(n)=3T(n/3)+nT(n) = 3T(n/3) +
nT(n)=3T(n/3)+n.
d) Explain how the Master’s Theorem is applied to analyze algorithms.
3. Long Answer Questions (10x5 = 50 Marks):
a) Analyze the time complexity of Quick Sort in the best, average, and worst cases.
b) Solve T(n)=T(n/2)+nT(n) = T(n/2) + \sqrt{n}T(n)=T(n/2)+nusing the Master’s
Theorem.
c) Write and analyze the Merge Sort algorithm with a focus on its recurrence relation.
d) Discuss the space complexity trade-off in recursive algorithms.
e) Analyze the Heap Sort algorithm and discuss its advantages over Quick Sort.
Question Paper 2
Question Paper 3
1.
2. Medium Answer Questions (5x4 = 20 Marks):
a) Compare the complexities of Merge Sort and Heap Sort.
b) Explain T(n)=2T(n/2)+nT(n) = 2T(n/2) + nT(n)=2T(n/2)+n using recursion tree.
c) Write the algorithm for Bubble Sort and explain its time complexity.
d) Discuss the trade-offs involved in using recursive algorithms.
3. Long Answer Questions (10x5 = 50 Marks):
a) Solve T(n)=4T(n/4)+nT(n) = 4T(n/4) + nT(n)=4T(n/4)+n using the Master’s Theorem.
b) Analyze the Quick Sort algorithm for its time complexity in all cases.
c) Discuss the significance of asymptotic notations in algorithm analysis.
d) Perform a detailed analysis of the performance of Selection Sort.
e) Explain the recurrence relation for Merge Sort and solve it step by step.