Question Paper
Exam Date & Time: 06-Jul-2023 (02:30 PM - 05:30 PM)
MANIPAL ACADEMY OF HIGHER EDUCATION
FOURTH SEMESTER B.TECH. DEGREE EXAMINATIONS - JUNE/JULY 2023
SUBJECT: CSE 2252/CSE-2252 - DESIGN AND ANALYSIS OF ALGORITHMS
(SPL: COMPUTER SCIENCE AND ENGINEERING - ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING / COMPUTER
SCIENCE / COMPUTER SCIENCE AND ENGINEERING - CYBER SECURITY)
(MAKEUP)
DESIGN AND ANALYSIS OF ALGORITHMS [CSE 2252]
Marks: 50 Duration: 180 mins.
A
Answer all the questions.
1A) Consider the following algorithm. (5)
i) What does this algorithm compute?
ii) What is its input size?
iii) What is its basic operation?
iv) How many times is the basic operation executed?
v) What is the efficiency class of this algorithm?
1B) Consider a string s= "she sells sea shells on the sea shore" and text t= "shell". Apply brute force (3)
string matching and analyse the time complexity for the same.
1C) Solve recurrence relation through substitution method (2)
T(n)={0 if n=0 and if n>0 T(n-2)+n2 }
2A) Sort the list Q, U, I, C, K, S, O, R, T in alphabetical order using merge sort algorithm and analyse (5)
the worst case time complexity for the same.
2B) Apply the divide and conquer method to sort the given elements 3, 5, -3, -1, 1, 2, 4 using first (3)
element as the pivot element. And also find the time complexity for the same.
2C) Compute the possible sequence using Topological sorting on the given graph. (2)
3A) i) Apply Boyer Moore algorithm to locate the pattern ANPANMAN in the following text: (5)
SUPERMAN IS BETTER THAN ANPANMAN
ii) Count the total number of comparisons made by the algorithm in locating the given pattern.
Page 1 of 2
iii) Analyse the time of complexity of the algorithm.
3B) Construct an AVL tree for the following data 21, 26, 30, 9, 4, 14, 28, 18, 15, 10. (3)
3C) Apply the single-source shortest path algorithm to find the shortest path from a to all other vertices (2)
in the following graph.
4A) Explain the properties of a heap and Apply heapsort to sort the given list in increasing order using (5)
max-heap representation.
80, 60, 30, 20. 50, 10, 40, 70
4B) Differentiate between Fixed length and variable length encoding. Construct a Huffman code for the (3)
following data.
Encode the text "ABACABAD" using the code obtained. Also, Decode the text whose encoding is
"100010111001010".
4C) Construct a 2-3 tree for the list C, O, M, P, U, T, I, N, G. Use the alphabetical order of the letters (2)
and insert them successively starting with the empty tree.
5A) Construct minimum spanning tree for the following graph using prim's algorithm. (5)
Compute the time complexity of the algorithm.
5B) Identify the order of growth of the following sums. (3)
5C) When is a problem said to be in class P? Justify the answer using a real-world examples. (2)
-----End-----
Page 2 of 2