DAA PYQs-2.0
DAA PYQs-2.0
**Q1) What are Asymptotic Notations? Explain any three Asymptotic Notations with expression
*Q2) Define algorithm.What is the need of algorithm analysis ? Which factors affect the runtime of an
algorithm ? State the main characteristics/properties of Algorithm. Explain criteria of Algorithms.
*Q4) Define Max and Min Heap and write an algorithm to insert into a heap. Explain with examples.
UNIT-02
n
*Q1)
lo
si
*Q2) Explain strassen’s matrix multiplication with its performance analysis.
Ep
*Q3) Solve using Strassen's Matrix Multiplication, and Calculate its time complexity
A = (6 7
54)
B = (1 2
34)
By
*Q5) Write an algorithm for merge sort.Apply merge sort on following array
A=51263794
A
*Q6) Write an algorithm of merge sort and illustrate the operation on an array using Merge Sort.
A = {5 2 4 7 1 3 2 6}
D
*Q7) Describe an algorithm for Merge Sort and find its time complexity
*Q8) Evaluate and write the algorithm for Quick sort describe its best and worst case with suitable example
CHARACTER A B C D E
FREQUENCY 6 11 19 35 50
*Q2) Construct an optimal instance of Huffman Code for the following set of frequencies using the Greedy
method.
CHARACTER A B C D E F
FREQUENCY 45 13 12 16 9 5
n
*Q3) What are the different elements of greedy strategy ? Explain the steps to solve the problem by
greedy strategy.
lo
**Q4) Draw a state space tree for finding four queens solutions
si
Q5) Apply branch and bound technique to solve travelling salesman problem for the graph whose matrix is
Ep
*Q6) Describe Graph Colouring Problem with suitable example
By
*Q2) Compare Greedy Strategy , Dynamic Programming and Divide and Conquer approach.
Q3) Determine longest common subsequence using dynamic programming approach for X and Y. What is the
length of the longest common subsequence?
X = < A, B, C, B, D, A, B >
Y = < B, D, C, A, B, A >
n
Q4) Find the shortest path using Bellman Ford algorithm for the following graph.
Note that vertex z is the source vertex.
lo
si
Ep
*Q5) Solve the Fractional Knapsack problem Given n = 5 objects and a knapsack capacity
W = 60 profit (30, 20, 100,90,160) Weight = (5,10,20,30,40)
*Q6) Solve knapsack problem by greedy method where capacity of knapsack is 15kg, profits of seven object
are
By
*Q7) Solve an optimal Huffman code for the following set of frequencies
a: 50 b: 25 c: 15 d: 40 e=75
Q11) Find an optimal solution to the knapsack instance n = 7, m = 15, (P1 ,P2, P3 ,P4 P5 ,P6 P7 ) =
(10,5,15,7,6,18,3), and (w1, w2, w3, w4, w5, w6, w7) = (2,3,5,7,1,4,1).
Q12) What is the Minimum Cost Spanning Tree? Explain with suitable example.
Q2) Given n=6 weights, w={5,10,12,13,15,18} and M=30 .Find all possible subsets for which sum=M using sum of
subsets algorithm.
Q3) Explain Class P, Class NP and Class NPC problems in detail. Show relationship between P class and NP class
.
Q4) Calculate the shortest path by using Floyd's Warshall Algorithm
n
lo
Q5) Calculate the longest common subsequence for
X={ A,B,C,B,D,A,B}
Y={B,D,C,A,B,A}
si
*Q6) Differentiate between Dynamic Programming and greedy Approach
Ep
Q7) Write down characteristics of dynamic programming.