Course Code : CAT 208 KQLR/RS – 24 / 1068
Fourth Semester B. Tech. ( Computer Science and Engineering /
Artificial Intelligence and Machine Learning ) Examination
DESIGN AND ANALYSIS OF ALGORITHMS
Time : 3 Hours ] [ Max. Marks : 60
Instructions to Candidates :—
(1) Assume suitable data wherever necessary.
(2) All questions carry marks as indicated.
1. (a) Solve the below recurrence relation using substitution method :
T(n) = T (n/2) + T (n/3) + n 5(CO1)
(b) State and explain the necessity of amortized analysis. Illustrate the process
with the help of binary counter. 5(CO1)
2. (a) Draw and split merge tree for the given sequences. Write algorithm for
recursive merge sort. How merge sort is different from quick sort ?
39, 9, 81, 45, 90, 27, 72, 18, 72, 50. 4(CO2)
(b) Multiply the given matrices A and B using Strassen's matrix multiplication
algorithm :
2 3 1 6 2 1 3 4
A = 3 1 5 0 B = 1 3 1 2
4 6 2 1 1 0 2 1
1 5 2 6 1 4 3 2 6(CO2)
KQLR/RS-24 / 1068 Contd.
3. (a) A knapsack can carry weights not exceeding 100. The weights and profits
of six objects are as follows :
Wi 10 20 30 40 50 60
Pi 23 34 66 20 10 15
Solve the above problem using Greedy approach based on profit, weight
and profit to weight ratio and find out the maximum profit that can be
earned. 5(CO2)
(b) What is Huffman encoding scheme ? How it is beneficial in generating
codes for alphabetic data set ? Use the method to derive the Huffman
tree for following data set :
Char A B C D E
Freq 12 5 15 22 9 5(CO2)
4. (a) Find optimal solution for the given sequences. Also find the length of Longest
common subsequences.
String 1 : S U B S E Q U E N C E
String 2 : U S A M E N I C E 5(CO3)
(b) Using all pairs shortest path algorithm find the length of shortest path from
all vertices to all other vertices of the given graph.
5(CO3)
5. (a) Formulate at least two solutions for the 8 Queen's problems using backtracking.
What the constraint applicable to solve the problems ? 5(CO3)
KQLR/RS-24 / 1068 2 Contd.
(b) Specify the bounding condition of sum of subset problem solved using
Backtracking. Apply backtracking procedure to obtain a sum (M) from the
subset of set given.
Given Set X = {5, 10, 12, 13, 15, 18}
M = 30. 5(CO3)
6. (a) Clearly define the polynomial reduction process. Define NP complete and
NP hard problem with the help of polynomial reduction. Give an example.
6(CO4)
(b) Discuss vertex cover problem. Find the minimum size vertex cover in given
graph.
4(CO4)
KQLR/RS-24 / 1068 3 75