0% found this document useful (0 votes)
2 views

Data structure pyqs

Uploaded by

akshatmishra2904
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Data structure pyqs

Uploaded by

akshatmishra2904
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Printed Pages: 2 Sub Code: KCS- 301

Paper Id: 233380 Roll No.

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

1. Attempt all questions in brief. 2 x 10 = 20


(a) Define best case, average case and worst case for analyzing the complexity of a
program.
(b) Differentiate between binary search tree and a heap.
(c) Write the condition for empty and full circular queue.
(d) What do you understand by tail recursion?
(e) Construct an expression tree for the following algebraic expression:
(a - b) / ((c * d) + e)
(f) Differentiate between internal sorting and external sorting.
(g) What are the advantages and disadvantages of array over linked list?
(h) Write an algorithm for Breadth First Search (BFS) traversal of a graph.
(i) In a complete binary tree if the number of nodes is 1000000. What will be the height

2
90

13
of complete binary tree.
_2

(j) Which data structure is used to perform recursion and why?

2.
SECTION B
P2

24
2. Attempt any three of the following: 10x3=30

5.
3D

(a) Assume that the declaration of multi-dimensional arrays X and Y to be,

.5
P2

X (-2:2, 2:22) and Y (1:8, -5:5, -10:5)


(i) 17
Find the length of each dimension and number of elements in X and Y.
Q

|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.

QP23DP2_290 | 27-03-2023 13:29:36 | 117.55.242.132


SECTION C
3. Attempt any one part of the following: 10x1=10
(a) How to represent the polynomial using linked list ? Write a C program to add two
polynomials using linked list.
(b) Discuss doubly linked list. Write an algorithm to insert a node after a given node
in singly linked list.
4. Attempt any one part of the following: 10x1=10
(a) Write an algorithm for converting infix expression into postfix expression. Trace
your algorithm for infix expression Q into its equivalent postfix expression P,
Q: A + ( B * C – ( D / E ^ F) * G ) * H
(b) What is circular Queue? Write a C code to insert an element in circular queue?
5. Attempt any one part of the following: 10x1=10
(a) What is Hashing? Explain division method to compute the hash function and also
explain the collision resolution strategies used in hashing.
(b) Write an algorithm for Heap Sort. Use Heap sort algorithm, sort the following
sequence:
18, 25, 45, 34, 36, 51, 43, and 24.
6. Attempt any one part of the following: 10x1=10
(a) What is spanning tree? Write down the Prim’s algorithm to obtain minimum cost

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

Floyd Warshall algorithm to find shortest path among all the


vertices in the given graph:
: 29
13
3
02
-2
03
7-
|2

7. Attempt any one part of the following: 10x1=10


(a) Discuss left skewed and right skewed binary tree. Construct an AVL tree by
inserting the following elements in the order of their occurrence:
60, 2, 14, 22, 13, 111, 92, 86.
(b) What is B-Tree? Write the various properties of B- Tree. Show the results of
inserting the keys F, S, Q, K ,C, L, H, T, V, W, M, R, N, P, A, B in order into a
empty B-Tree of order 5.

QP23DP2_290 | 27-03-2023 13:29:36 | 117.55.242.132


Printed Page: 1 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

Time: 3 Hours Total Marks: 100


Note: Attempt all Sections. If you require any missing data, then choose suitably.
SECTION A
1. Attempt all questions in brief. 2X10 = 20
Q No Questions CO
(a) Convert the infix expression (A+B) *(C-D) $E*F to postfix. Give the answer 1
without any spaces.
(b) Rank the following typical bounds in increasing order of growth rate: 2
O(log n), O(n4), O(1), O(n2 log n)
(c) Draw the binary search tree that results from inserting the following numbers in 3
sequence starting with 11: 11, 47, 81, 9, 61, 10, 12,
(d) What does the following recursive function do for a given Linked List with first 4
node as head?
void fun1(struct node* head)
{
if(head == NULL)
return;
fun1(head->next);
printf("%d ", head->data);
}
(e) Define a sparse matrix. Suggest a space efficient representation for space matrices. 5
(f) List the advantages of doubly linked list over single linked list. 1
(g) Give example of one each stable and unstable sorting techniques. 2
(h) Write advantages of AVL tree over Binary Search Tree (BST) 3
(i) What is tail recursion? Explain with a suitable example. 4
(j) Write different representations of graphs in the memory. 5
SECTION B
2. Attempt any three of the following: 10X3 = 30
Q No Questions CO
(a) Write advantages and disadvantages of linked list over arrays. Write a 'C' function 1
creating new linear linked list by selecting alternate elements of a linear linked list.
(b) Write algorithms of insertion sort. Implement the same on the following numbers; 2
also calculate its time complexity. 13, 16, 10, 11, 4, 12, 6, 7
(c) Differentiate between DFS and BFS. Draw the breadth First Tree for the above 3
graph.

(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.

6. Attempt any one part of the following: 10X1 = 10


Q No Questions CO
(a) (i) Write an iterative function to search a key in Binary Search Tree (BST). 4
(ii) Discuss disadvantages of recursion with some suitable example.
(b) (i) What is Recursion? 4
(ii)Write a C program to calculate factorial of number using recursive and non-
recursive functions.
7. Attempt any one part of the following: 10X1 = 10
Q No Questions CO
(a) (i) Why does time complexity of search operation in B-Tree is better than Binary 5
Search Tree (BST)?
(ii) Insert the following keys into an initially empty B-tree of order 5
a, g, f, b, k, d, h, m, j, e, s, i, r, x, c, l, n, t, u, p
(iii) What will be the resultant B-Tree after deleting keys j, t and d in sequence?
(b) (i) Design a method for keeping two stacks within a single linear array so that 5
neither stack overflow until all the memory is used.
(ii) Write a C program to reverse a string using stack.
Printed Page: 1 of 2
Subject Code: KCS301
0Roll No: 0 0 0 0 0 0 0 0 0 0 0 0 0

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

1. Attempt all questions in brief. 2 x 10 = 20


Q no. Question Marks CO
a. Define Time-Space trade-off. 2 1
b. Differentiate Array and Linked list. 2 1
c. Explain Tail Recursion with suitable example. 2 2
d. Write the full and empty condition for a circular queue data structure. 2 2
e. Examine the minimum number of interchanges needed to convert the 2 3
array 90, 20, 41,18, 13, 11, 3, 6, 8,12, 7, 71, 99 into a maximum heap.
f. Differentiate sequential search and binary search. 2 3
g. Compute the Transitive closure of following graph. 2 4

h. Write short notes on adjacency multi list representation a Graph. 2 4


i. What is the importance of threaded binary tree? 2 5
j. Write short notes on min heap. 2 5

SECTION B

2. Attempt any three of the following:


Q no. Question Marks CO
a. Consider a multi-dimensional Array A[90] [30] [40] with base address 10 1
starts at 1000. Calculate the address of A[10] [20] [30] in row major
order and column major order. Assume the first element is stored
at A[2][2][2] and each element take 2 byte.
b. Evaluate the following postfix expression using stack. 10 2
2 3 9 * + 2 3 ^ - 6 2 / + , show the contents of each and every steps. also
find the equivalent prefix form of above expression. Where ^ is an
exponent operator.
c. Explain any three commonly used hash function with the suitable 10 3
example? A hash function H defined as H(key) =key%7, with linear
probing, is used to insert the key 37,38,72,48,98,11,66 into a table
indexed from 0 to 6. what will be the location of key 11? Justify your
answer, also count the total number of collisions in this probing.
d. Write an algorithm for Breadth First search (BFS) and explain with the 10 4
help of suitable example.
e. If the in order of a binary tree is B,I,D,A,C,G,E,H,F and its post order is 10 5
I,D,B,G,C H,F,E,A then draw a corresponding binary tree with neat and
clear steps from above assumption.

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

4. Attempt any one part of the following:


Q no. Question Marks CO
a. Convert the following infix expression to reverse polish notation 10 2
expression using stack.
𝑏 √𝑏 4𝑎𝑐
𝑥
2𝑎

b. Write a C program to implement stack using single linked list. 10 2

5. Attempt any one part of the following:


Q no. Question Marks CO
a. Write an algorithm for merge sort and apply on following elements 10 3
45,32,65,76,23,12,54,67,22,87.
b. Write a C program for Index Sequential Search. 10 3

6. Attempt any one part of the following:


Q no. Question Marks CO
a. Describe Prim`s algorithm and find the cost of minimum spanning tree 10 4
using Prim`s Algorithm.

b. Apply the Floyd warshall’s algorithm in above mentioned graph 10 4


(i.e. in Q.no 6a)

7. Attempt any one part of the following:


Q no. Question Marks CO
a. Write Short notes of following 10 5
(a) Extended Binary Trees (b) Complete Binary Tree
(c) Threaded Binary Tree.
b. Insert the following sequence of elements into an AVL tree, starting 10 5
with empty tree 71,41,91,56,60,30,40,80,50,55 also find the minimum
array size to represent this tree.

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

1. Attempt all questions in brief. 2 x 7 = 14


a. How the graph can be represented in memory? Explain with suitable
example.
b. Write the syntax to check whether a given circular queue is full or empty?
c. Draw a binary Tree for the expression: A * B - (C + D) * (P /Q)
d. Differentiate between overflow and underflow condition in a linked list.
e. What do you understand by stable and in place sorting?
f. Number of nodes in a complete tree is 100000. Find its depth.
g. What is Recursion? Give disadvantages of recursion.

SECTION B

2. Attempt any three of the following: 7 x 3 = 21


a. What do you understand by time and space trade off? Define the various
asymptotic notations. Derive the O-notation for linear search.

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].

4. Attempt any one part of the following: 7x1=7


(a) Explain Tower of Hanoi problem and write a recursive algorithm to solve it.
(b) Explain how a circular queue can be implemented using arrays. Write all
functions for circular queue operations.

5. Attempt any one part of the following: 7x1=7


(a) Write the algorithm for deletion of an element in binary search tree.
(b) Construct the binary tree for the following.
In-order: Q, B, K, C, F, A, G, P, E, D, H, R
Preorder: G, B, Q, A, C, K, F, P, D, E, R, H
Find the Post Order of the Tree
6. Attempt any one part of the following: 7x1=7
(a) By considering vertex ‘1’ as source vertex, Find the shortest paths to all other
vertices in the following graph using Dijkstra’s algorithms. Show all the steps.

(b) Explain in detail about the graph traversal techniques with suitable examples.

7. Attempt any one part of the following: 7x1=7


(a) Write algorithm for Quick sort. Trace your algorithm on the following data to
sort the list: 2, 13, 4, 21, 7, 56, 51, 85, 59, 1, 9, 10. How the choice of pivot
element effects the efficiency of algorithm.
(b) Construct a B-tree of order 5 created by inserting the following elements
3, 14, 7, 1, 8, 5, 11, 17, 13, 6, 23, 12, 20, 26, 4, 16, 18, 24, 25, 19
Also delete elements 6, 23 and 3 from the constructed tree.
www.aktuonline.com
Printed Pages: 02 Sub Code: RCS305

Paper ID: 1 0 0 4 Roll No.


B TECH
(SEM III) THEORY EXAMINATION 2017-18
DATA STRUCTURES
Time: 3Hours Max. Marks: 70
Note: Attempt all Sections. Assume missing data, if any.
SECTION A
1. Attempt all questions in brief: 2 x 7 = 14
a. Define the term Data Structure. List some linear and non-linear data
structures stating the application area where they will be used.
b. Discuss the concept of "successor" and “predecessor” in Binary Search
Tree.
c. Convert the following arithmetic infix expression into its equivalent postfix
expression.
Expression: A-B/C+D*E+F
d. Explain circular queue. What is the condition if circular queue is full?
e. Calculate total number of moves for Tower of Hanoi for n=10 disks.
f. List the different types of representation of graphs.
g. Explain height balanced tree. List general cases to maintain the height.
SECTION B
www.aktuonline.com

2. Attempt any three of the following: 7 x 3 = 21

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

3. Attempt any one part of the following: 7x1=7


(a) What are the various asymptotic notations? Explain Big O notation.
(b) Write an algorithm to insert a node at the end in a Circular linked list.

1|Page

www.aktuonline.com
www.aktuonline.com
4. Attempt any one part of the following: 7x1=7

(a)What is a Stack .Write a C program to reverse a string using stack.


(b)Define the recursion. Write a recursive and non recursive program to calculate
the factorial of the given number.

5. Attempt any one part of the following: 7x1=7

(a) Draw a binary tree with following traversals:


Inorder: B C A E G D H F I J
Preorder: A B C D E G F H I J
(b) Consider the following AVL Tree and insert 2, 12, 7and 10 as new node. Show
proper rotation to maintain the tree as AVL.

6. Attempt any one part of the following: 7x1=7

(a)What is a Threaded Binary Tree? Explain the advantages of using a threaded


binary tree.
(b)Describe Dijkstra’s algorithm for finding shortest path. Describe its working for
the graph given below.
www.aktuonline.com

7. Attempt any one part of the following: 7x1=7


(a)Write short notes on:
i. Hashing Technique
ii. Garbage collection
(b)Explain the following:
i. Heap Sort
ii. Radix Sort.

2|Page

www.aktuonline.com

You might also like