Data structure pyqs
Data structure pyqs
B. TECH.
(SEM III) THEORY EXAMINATION 2022-23
DATA STRUCTURE
Time: 3 Hours Total Marks: 100
Note: 1. Attempt all Sections. If require any missing data; then choose suitably.
SECTION A
2
90
13
of complete binary tree.
_2
2.
SECTION B
P2
24
2. Attempt any three of the following: 10x3=30
5.
3D
.5
P2
|1
(ii) Find the address of element Y (2, 2, 3), assuming Base address of Y = 400
and each element occupies 4 memory locations.
6
:3
(b) What is Stack? Write a C program for linked list implementation of stack.
29
(c) Write an algorithm for Quick sort. Use Quick sort algorithm to sort the following
:
elements: 2, 8, 7, 1, 3, 5, 6, 4
13
(d) Write the Dijkstra algorithm for shortest path in a graph and also find the shortest path
from ‘S’ to all remaining vertices of graph in the following graph:
3
02
-2
03
7-
|2
(e) The order of nodes of a binary tree in inorder and postorder traversal are as follows:
In order : B, I, D, A, C, G, E, H, F.
Post order: I, D, B, G, C, H, F, E, A.
(i) Draw the corresponding binary tree.
(ii) Write the pre order traversal of the same tree.
2
90
spanning tree. Use Prim’s algorithm to find the minimum cost spanning tree
13
in the following graph:
_2
2.
P2
24
5.
3D
.5
P2
17
Q
|1
(b) Write and explain the Floyd Warshall algorithm to find the all pair shortest path. Use the
6
:3
BTECH
(SEM III) THEORY EXAMINATION 2021-22
DATA STRUCTURE
(d) Differentiate between liner and binary search algorithm. Write a recursive function 4
to implement binary search.
(e) What is the significance of maintaining threads in Binary Search Tree? Write an 5
algorithm to insert a node in thread binary tree.
SECTION C
3. Attempt any one part of the following: 10X1 = 10
Q No Questions CO
(a) Suppose a three dimensional array A is declared using A[1:10, -5:5, -10:5) 1
(i) Find the length of each dimension and the number of elements in A
(ii) Explain Row major order and Column Major Order in detail with explanation
formula expression.
Printed Page: 2 of 2
Subject Code: KCS301
0Roll No: 0 0 0 0 0 0 0 0 0 0 0 0 0
BTECH
(SEM III) THEORY EXAMINATION 2021-22
DATA STRUCTURE
(b) Discuss the representation of polynomial of single variable using linked list. Write 1
'C' functions to add two such polynomials represented by linked list.
4. Attempt any one part of the following: 10 X1 = 10
Q No Questions CO
(a) (i) Use the merge sort algorithm to sort the following elements in ascending order. 2
13, 16, 10, 11, 4, 12, 6, 7.
What is the time and space complexity of merge sort?
(ii) Use quick sort algorithm to sort 15,22,30,10,15,64,1,3,9,2. Is it a stable sorting
algorithm? Justify.
(b) (i) The keys 12, 17, 13, 2, 5, 43, 5 and 15 are inserted into an initially empty hash 2
table of length 15 using open addressing with hash function h(k) = k mod 10 and
linear probing. What is the resultant hash table?
(ii) Differentiae between linear and quadratic probing techniques.
5. Attempt any one part of the following: 10X1 = 10
Q No Questions CO
(a) Use Dijkstra’s algorithm to find the shortest paths from source to all other vertices in 3
the following graph.
(b) Apply Prim’s algorithm to find a minimum spanning tree in the following weighted 3
graph as shown below.
B. TECH
(SEM III) THEORY EXAMINATION 2020-21
DATA STRUCTURES
Time: 3 Hours Total Marks: 100
Note: 1. Attempt all Sections. If require any missing data; then choose suitably.
SECTION A
SECTION B
1|Page
Printed Page: 2 of 2
Subject Code: KCS301
0Roll No: 0 0 0 0 0 0 0 0 0 0 0 0 0
SECTION C
3. Attempt any one part of the following:
Q no. Question Marks CO
a. Consider the two dimensional lower triangular matrix (LTM) of order 10 1
N ,Obtain the formula for address calculation in the address of row
major and column major order for location LTM[j][k], if base address
is BA and space occupied by each element is w byte.
b. Write a C program to insert a node at kth position in single linked list. 10 1
2|Page
Printed Pages: 02 Sub Code: RCS305
Paper Id: 1 1 0 3 0 3 Roll No.
B. TECH.
(SEM III) THEORY EXAMINATION 2018-19
DATA STRUCTURES
Time: 3 Hours Total Marks: 70
Note: 1. Attempt all Sections. If require any missing data; then choose suitably.
SECTION A
SECTION B
b. Consider the following infix expression and convert into reverse polish
notation using stack. A + (B * C – (D / E ^ F) * H)
c. Explain Huffman algorithm. Construct Huffman tree for MAHARASHTRA
with its optimal code.
d. What is a height balanced Tree? Why height balancing of Tree is required?
Create an AVL Tree for the following elements: a, z, b, y, c, x, d, w, e, v, f
e. Write the Floyd Warshall algorithm to compute the all pair shortest path. Apply
the algorithm on following graph:
SECTION C
3. Attempt any one part of the following: 7x1=7
(a) Write a program in c to delete a specific element in single linked list. Double
linked list takes more space than single linked list for storing one extra address.
Under what condition, could a double linked list more beneficial than single
linked list.
(b) Suppose multidimensional arrays P and Q are declared as P (-2: 2, 2: 22) and
Q (1: 8, -5: 5, -10: 5) stored in column major order
(i) Find the length of each dimension of P and Q
(ii) The number of elements in P and Q
(iii) Assuming Base address (Q) = 400, W=4, Find the effective indices E1,
E2, E3 and address of the element Q [3, 3, 3].
(b) Explain in detail about the graph traversal techniques with suitable examples.
a. What do you understand by time space trade off? Explain best, worst and average case
analysis in this respect with an example
b. Use quick sort algorithm to sort 15,22,30,10,15,64,1,3,9,2. Is it a stable sorting
algorithm? – Justify.
c. Define spanning tree. Also construct minimum spanning tree using prim’s algorithm for
the given graph.
d. Define tree, binary tree, complete binary tree and full binary tree. Write algorithms or
function to obtain traversals of a binary tree in preorder, postorder and inorder.
e. Construct a B-tree on following sequence of inputs.
10, 20, 30, 40, 50, 60, 70, 80, 90
Assume that the order of the B-tree is 3.
SECTION C
1|Page
www.aktuonline.com
www.aktuonline.com
4. Attempt any one part of the following: 7x1=7
2|Page
www.aktuonline.com