0% found this document useful (0 votes)
10 views

DAA1 Rev Test

Uploaded by

soradesigns21
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

DAA1 Rev Test

Uploaded by

soradesigns21
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Question Paper 1

Unit 1: Introduction to Algorithms


Short Answer Questions (2x5 = 10 Marks):
a) Define an algorithm. List its characteristics.
b) Explain the significance of analyzing an algorithm.
c) Differentiate between best, average, and worst-case behavior.
d) Describe the time-space trade-off in algorithms.
e) Write the recurrence relation for the time complexity of the following recursive function:
c
Copy code
void func(int n) {
if (n > 1) {
func(n/2);
func(n/2);
}
}

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)+n​using 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

Unit 1: Introduction to Algorithms

1. Short Answer Questions (2x5 = 10 Marks):


a) What is the role of asymptotic notations in algorithm analysis?
b) Give examples of algorithms with O(nlog⁡n)O(n \log n)O(nlogn) complexity.
c) How is time complexity measured in iterative algorithms?
d) Define space complexity and give one example where it is critical.
e) What are the conditions for applying the Master’s Theorem?
2. Medium Answer Questions (5x4 = 20 Marks):
a) Solve T(n)=4T(n/2)+n2T(n) = 4T(n/2) + n^2T(n)=4T(n/2)+n2 using recursion tree
method.
b) Compare Insertion Sort and Selection Sort in terms of their space and time
complexity.
c) Explain the best, average, and worst-case complexities of Binary Search.
d) Discuss the impact of recursion on space complexity with examples.
3. Long Answer Questions (10x5 = 50 Marks):
a) Perform a detailed performance analysis of Merge Sort and explain its time and space
complexities.
b) Solve T(n)=T(n/2)+nlog⁡nT(n) = T(n/2) + n \log nT(n)=T(n/2)+nlogn using substitution.
c) Write an algorithm for Quick Sort and explain its working with an example.
d) Discuss the recursion tree approach for solving recurrence relations.
e) Analyze the performance of Counting Sort and discuss when it is suitable for use.

Question Paper 3

Unit 1: Introduction to Algorithms


Short Answer Questions (2x5 = 10 Marks):
a) What is the difference between O(1)O(1)O(1), O(n)O(n)O(n), and O(log⁡n)O(\log n)O(logn)?
b) List the key steps of the Master’s Theorem.
c) Explain the significance of recurrence relations in analyzing recursive algorithms.
d) What are the characteristics of an efficient sorting algorithm?
e) Write the recurrence relation for the following code and mention its time complexity:
c
Copy code
int func(int n) {
if (n <= 1) return 1;
return func(n-1) + func(n-1);
}

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.

You might also like