Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

ANALYSIS OF ALGORITHM

Q.1 Write on Short Answer


(i) Explain best-case, average-case, worst-case running time of Merge sort algorithm
(ii) What kind of input does the Quick sort algorithm exhibit its worst-case behaviour?
Why?
(iii) What is the Greedy approach? Does it always given Optimal Solution?
(iv) Explain Strassen's matrix multiplication
(v) Write the Knuth-Morris-Pratt String Matching algorithm
(vi) Differentiate between Dynamic Programming and Divide & Conquer strategy.
(vii) Discuss worst case time complexity of Quick sort.
(viii) Justify Strassen’s matrix multiplication is better than conventional method.
(ix) Define matrix chain multiplication problem with suitable example.
(x) What do you understand by backtracking algorithms? Explain with example.
(xi) What is the importance of Rabin Karp String matching?
(xii) Explain asymptotic Notations?
(xiii) Sort the given element using quick sort :45,32,12,13,89
(xiv) Explain Lower bound theory?
(xv) Explain naïve string matching?

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 ∞

(i)What is the reduced cost matrix?


(ii)Find the optimal tour of given Travelling Salesman problem
(iii) Solve the following 0/1 knapsack problem for n=5 and M =6
W:2,3,3
V:1,2,4
(iv) What is dynamic programming? How it gives the optimal solution?
Consider n=3, consider M=6, (W1, W2, W3) = (2, 3, 3) and (P1, P2, P3) = (1, 2, 4)
Find optimal solution for given knapsack problem.
(v) Solve the TSP having the following cost matrix for using branch and bound approach
A B C D
A X 5 2 3
B 4 X 2 3
C 4 2 X 3
D 7 6 8 X

(vi) Given the text:


T= 2359023141526739921
P=31415 and q =13
Choose the pattern matching with average case complexity and explain the search
process. Justify the answer for choosing such algorithm.
(vii) Solve TSP having the following cost matrix for the branch and bound approach
A B C D
A X 5 2 3
B 4 X 2 3
C 4 2 X 3
D 7 6 8 X
(viii) X=(A,A,B,A,B) AND Y=(B,A,B,B) find the longest common subsequences (LCS) of
the given subsequences’ X and Y using dynamic approach
(ix) Solve the recurrence relation for time complexity using master method
I. T(n)=4T(n/2)+3n
II. T(n)=5T(n/5)+n2

You might also like