Professional Documents
Culture Documents
AoA Important Question
AoA Important Question
Q.2 (i) Solve the following recurrence relation and fine their complexity using master method
(i)T(n)=4T(n/2)+n2
(ii) T(n)=2T(n/4)+n log n
(ii) Using Rabin Karp algorithm to solve the T= 45759162345698765531 and P=234 and
Q=11.
(iii) Consider a Knapsack problem for n=3,M=20, (v1,v2,v3,)=(25,24,15),
(w1,w2,w3)= (18, 15,10) Solve Greedy Method.
(iv) Fined longest common subsequence of the given sequences X1 and X2 using all the
steps of dynamic programming.
X1=MLNOM
X2=MNOM
(v) Write Boyer- Moore Matcher algorithm for string matching. What is the use of prefix
function in KMP string matching algorithm?
(vi) Explain Backtracking method by using the example of 4-Queen Problem with flow
diagram.
(vii) Solve the following optimal merge pattern using greedy approach:
5,4,7,2,9,11,4,8
(viii) Write an algorithm to search an element in to array using binary search. Discuss time
complexity of Algorithm.
(ix) Illustrate the operation of merge sort on following array:
10, 20,5,23,45,34,12
(x) Solve the following Recurrence equation using Master method
1. T(n)= 5T(n/5)+√n
2. T(n)=4T(n/2)+n2√n
(xi) What is the use of prefix function in KMP string matching algorithm? Explain with
example.
(xii) Define Minimum Cost Spanning Tree. Write Algorithm to find MST using Krushkal’s
method.
(xiii) Explain and construct the KMP flow chart for pattern p=”ABABCB” and also show the
actions perform of KMP flow chart with given text T=”ACABAABABA”
(xiv) What is the need of analysis of algorithm? Discuss various notations in brief?
Explain Minimum Spanning Tree? Find MST using Krushkal’s Method?
(xv)
(xvi) Write an algorithm to search an element in to array using binary search. Also discuss the
runtime complexity of the algorithm?
(xvii) Match the pattern=C,C,T,T,T,T,G,C in given string
=G,C,T,T,C,T,G,C,T,A,C,C,T,T,T,T,T,G,C,G,C using Boyer’s and Moore algorithm?
(xviii) Explain difference between dynamic programming and branch and bound?
(i)
Write an algorithm for matrix chain multiplication. Find an optimal parenthesization
Q.3 of a matrix chain product whose sequence of dimensions is (5,10,3,12,5,50,6)
(ii) For given Travelling Salesman Problem matrix
∞ 12 5 7
11 ∞ 13 6
4 9 ∞ 18
10 3 2 ∞