You are on page 1of 1

Roll Number:

Thapar Institute of Engineering and Technology, Patiala


Department of Electronics and communication Engineering
Auxiliary EXAMINATION
Course Name: Data Structures and Algorithms Course Code: UCS613

Time: 2 Hours M. Marks: 50


Note: Attempt five questions out of seven. Pseudo codes/programs (in C of C++) both are
acceptable. Assume missing data, if any, suitably

Q.1 Sort the elements of following array using insertion sort and heap sort. Write (10)
down all the steps (explaining only first two steps) for both the methods.
Array A= [ 25 65 71 81 36 90 57]
Write down the pseudo code for both the methods and compare their time
complexity.

Q.2 a. Write an algorithm for Infix expression to Postfix expression using (5+5)
Stack and show the details of Stack at each step of conversion.
Infix = 10 + 20 * (3 ^2 — 4)/((9 + 1) * 2)) — 5
b. Create Binary Search Tree with following node values- 10, 12, 5, 4,
20, 8, 7, 15, 13. Delete node 10 from the Binary search tree.
Q.3 'a) Prove that time complexity of the Quick Sort Algorithm in the best (5+5)
case is equivalent to T(n) = nlog2n
b) Write an algorithm for performing insertion and deletion operation in a
queue using array implementation.
Q.4 Explain following four with the appropriate examples: (2.5*4)
a) Time-Space trade-off, b) Binary search, c) Insertion sort


d) Priority Queue
Q.5 a. Define asymptotic notations and what is its utility in analysis of (5+5)
algorithms'?

• Q.6
b. Find the complexity of the below recurrence with proper justification:
T(n) = 8T(n/2) + n2 (T(1) = 1)
Apply Prim's algorithm on the following graph to generate the minimum (10)
spanning tree. Assume starting vertex as A, and show all the intermediate
trees.

E
0 i
• // .... D_
i

CON
1N.
12
5 ,. _ / 6/ /
N i ,

0 -- 11:

Q.7 You have been given a linked list as Listl= {1.1, L2, L3 Ln-1, Lab write a (10)
program to re-order it to {Li, L.,, L2, L„ _1. L3. Ln-2 ..... .....}.
1

You might also like