Jaypee Institute of Information Technology, Noida
T2 Examination, 2022
B. Tech III Semester
Course Title: Data Structure and Algorithms Maximum Time: 1 Hr
Course Code: 18B11CS211 - Maximum Marks: 20
After pursuing the course, the students will be able to:
COL. Analyze the complexity of different algorithms using asymptotic analysis.
CO2. Implement various linear and non linear data structures and their related operations
CO3. Select and apply relevant data structure for a given problem and evaluate its performance.
COA. Select and apply appropriate algorithmic design technique (Greedy, backtracking, Divide and Conquer, DP) for
solving a given problem and evaluate the solution.
_— QU. [COI] Solve the recurrence relation using the Master theorem method: 8T(n/2) + 1000n” . Compute
the values of T(n) and f{n). Write all cases for the function f(n) using different asymptotic notations to
select the suitable bound. [3 Marks}
Q2. [CO3] Compute the average number of comparisons performed by the merge sort algorithm, in
merging 2 sorted lists each of length 2. [2 Marks]
17 Q3. [CO2] Consider an array of n elements. Your task is to repeatedly extract the maximum element from
the array, delete if from the array and then insert in the same order into two different tree structures AVL
tree and a BST. Determine the depth of both these tree structure (AVL and BST) with a suitable
calculation. [2 Marks}
AA. [CO2] With respect to AVL trees answer the following [2+3 Marks]
_J7-Hlow many total left and right rotations are required during the construction of an AVL tree if the
following elements are added in the given order: 35,50,40,25,30,60,78,20,28. Draw the AVL tree.
_A2- Delete node 60 from the AVE tre constructed in part Identify the suitable case to delete the node and
write the code for the delete function.
QS. [CO2] You are given with a binary search tree with pre-order traversal: 100,20,10,30.200,150,300
Consider the BST to be a complete tree. Your task is to convert the given binary search tree into a max
heap by considering the in-order traversal of BST. Your code must include functions:
Convert BST_MaxHeap that takes the root of the BST, function to traverse the tree and function to display
the heap. What is the worst-case time complexity of function convert_BST_MaxHeap [5 Marks}
6. {CO2} Consider an undirected graph G with vertex set {v1512,v3.04.05,¥677} and edge set (v1y2.-
We3av1v4.v2v4,V2V5,V3V4,v4V5,V4¥6,v5v6,V6V7}. Perform breadth first search after constructing the
raph with v1 as root node, [3 Marks]