** MODEL PAPER**

** B.Tech (CSE) Degree Examination**

** 3rd sem**

** Data Structures**

Effective from the admitted batch of 2004-2005

Time: 3 hrs

Max Marks: 70

First Question is Compulsory

Answer any four from the remaining questions

All Questions carry equal marks

Answer all parts of any question at one place

1. Briefly answer the following questions: (7*2=14)

a. Define Abstract Data Type ? How are they used in program development.

b. Write the primitive operations of ADT queue.

c Write the prefix and postfix equivalents to the infix expression A/B+C-D *(E+F).

d. Write the best, worst and average case time complexity estimates of Quick Sort algorithm.

e. What is an Almost Complete Binary Tree? Write an application that makes use of it.

f. Write the applications of depth first traversal of a graph.

g. When does interpolation search performs better than binary search?

2. a. Assume that each element of an array ‘A’ stored in row-major order occupies four bytes of memory. If ‘A’ is declared as: int a [10][20][5]. And the address of the first element of ‘A’ is 2000, find the address of the array element A[5][12][4]. (6)

b. Write a C program to evaluate a given postfix expression using stack and explain it with an example. (8)

3. a. Write a recursive function in C to find the nth Fibonacci number (5)

b. Write a non – recursive function for the above problem. (5)

c. Compare the efficiencies of the above two functions. (4)

4. a. Compare and contrast the ADTs Queue and Priority Queue. (6)

b. Write a C function to concatenate two singly linked circular list without traversing either of them and explain it. (8)

5. a. Discuss different ways of representing a binary tree and suggest an application for each of the representations. (8)

b. Explain how the threads are used to simplify the traversal of a binary tree. (6)

6. a. Construct a binary search tree to accommodate the given list of integers. (5)

47, 56, 23, 17, 64, 36, 29, 22

b. Find the in order, preorder and post order sequence of nodes of the above tree. (6)

c. Explain the process of deletion of node ’23’ from the above tree and draw the resultant tree. (4)

7. Write a C function to arrange the elements of an array in ascending order using Radix soil algorithm and explain it with a suitable example. (14)

8. a. Discuss the Dijkstra’s algorithm for finding the shortest paths from a source to all other vertices in a directed graph. What is its time complexity. (7)

b. Apply Kruskal’s algorithm to find the minimal spanning tree for a weighted undirected graph whose adjacency/weight matrix is given below.

i) Draw the graph. (3)

ii) Show different stages of development of the above spanning tree. (8)

iii) Find the cost of the minimal spanning tree. (3)

0 6 1 5 ∞ ∞ 6 0 5 ∞ 3 ∞ 1 5 0 5 6 4 5 ∞ 5 0 ∞ 2 ∞ 8 6 ∞ 0 6 ∞ ∞ 4 2 6 0