DAA - Part B&C
DAA - Part B&C
1. Describe how to implement a stack using an array. What are the time
complexities for push, pop, and peek operations?
Compare Big O vs Big Theta Θ vs Big Omega Ω Notations
OR
For T(n)=7T(n/2)+18n2 Solve the recurrence relation and find the time
complexity.
What is the difference between a binary tree and a binary search tree?
Describe the properties of a binary search tree
2. Explain how Strassen's algorithm uses the Divide and Conquer approach
to multiply two matrices. What are the sub-problems solved in the divide
step?
Design an algorithm to find the maximum and minimum element in a
given list of n numbers using divide and conquer method.
OR
What is the average-case time complexity of Quick Sort? Explain briefly
how it achieves this efficiency
Write algorithm for Merge Sort and Trace 60, 50, 25, 10, 35, 25, 75, 30.
3. What are the steps involved in solving the 0/1 Knapsack Problem using
Dynamic Programming.
OR
What is the purpose of finding the Minimum Cost Spanning Tree in a
graph? Give an example of a real-world application.
4. Define the cost of a node in an OBST. How is the total cost of the tree
calculated?
OR
Find the optimal binary search tree for the identifier set:
(a1,a2,a3,a4)={for,else,if,while} with p[1]=1/20,p[2]=1/5,
p[3]=1/10,p[4]=1/20, and
q[0]=1/5,q[1]=1/10,q[2]=1/5,q[3]=1/20,q[4]=1/20.
5. Given an undirected graph determine whether the graph contains a
Hamiltonian cycle or not. If it contains, then prints the path.
Input: graph[][] = {{0, 1, 0, 1, 0},{1, 0, 1, 1, 1},{0, 1, 0, 0, 1},{1, 1, 0,
0, 1},{0, 1, 1, 1, 0}}
PART C
Object 1 2 3 4 5 6 7
Weight 2 3 5 7 1 4 1
Profit 10 5 15 7 6 18 3
OR
Find the minimum spanning tree for the following graph using Kruskal’s
algorithms.