2024 May Dsa-Pattern-2019
2024 May Dsa-Pattern-2019
8
23
PB3653 [Total No. of Pages : 4
ic-
[6261]-61
tat
S.E. (I.T.)
1s
DATA STRUCTURES AND ALGORITHMS
0:4
(2019 Pattern) (Semester - III) (214443)
02 91
3:4
Time : 2½ Hours] [Max. Marks : 70
0
41
1/0 13
Instructions to the candidates:
1) Answer Q.1 or Q.2, Q.3 or Q.4, Q.5 or Q.6 and Q.7 or Q.8.
0
2) Neat diagrams must be drawn wherever necessary.
5/2
.23 GP
8
C
23
ic-
Q1) a) Imagine we have two empty stacks of integers, S1 and S2. Draw a picture
16
tat
8.2
1s
i) S1. Push (3);
.24
3:4
iv) S1. Push (9);
30
41
{
CE
8
23
X = S1. Pop (); to postfix most common
.23
tat
}
8.2
1s
.24
0:4
91
49
3:4
expression to prefix.
41
A^B*C–D+E/F/(G+H) [6]
01
02
i) enqueue ()
CE
82
ii) dequeue()
.23
iii) print_Queue()
16
8.2
OR
.24
P.T.O.
49
[6261]-61 1
Q2) a) If the values of A, B, C, and D are 2, 3, 4, and 5 respectively. Calculate
8
23
the value of the following prefix expression and clearly indicate the content
ic-
of stack. (Consider ‘_’ as a minus sign) [6]
tat
i) + – * A B C D
1s
ii) – * A + B C D
0:4
02 91
3:4
b) Consider the following circular queue of characters of size 6. “_”
0
denotes an empty queue location. Initial queue configuration is
41
1/0 13
Front = 1, Rear = 3 and having letters as shown below. [6]
0
i) F is added to the queue
5/2
.23 GP
8
C
23
v) Two letters are deleted
ic-
vi) S is added to the queue
16
tat
vii) Two letters are deleted
8.2
1s
Show the queue content of queue with Front and Rear as the above
.24
0:4
options take place.
91
49
3:4
c) What is double ended queue? Mention Types of double ended queue.
30
Q3) a) Create a binary tree from given preorder and inorder traversal. Show all
5/2
GP
Preorder : G B Q A C K F P D E R H
CE
82
8
Inorder : Q B K C F A G P E D H R
23
.23
b) Write the C++ pseudocode algorithm for creating expression tree from ic-
16
tat
postfix expression. [6]
8.2
1s
.24
0:4
c) Construct an inorder threaded binary search tree for the following set of
91
49
3:4
elements. [5]
30
OR
1/0
b) Draw the expression tree for the given postfix expression. Clearly indicate
the content of stack. Write the inorder and preorder traversal of the
16
ABC*+E*F+
.24
49
[6261]-61 2
c) Explain the following terms with respect to tree. [5]
8
i) Root
23
ii) Leaf node
ic-
iii) Siblings
tat
iv) Degree of a node
1s
v) Degree of tree
0:4
02 91
3:4
Q5) a) Find the minimum spanning tree using Prim’s algorithm for the following
0
41
graph. 1/0 13 [6]
0
5/2
.23 GP
E
82
8
C
23
ic-
16
tat
8.2
1s
.24
0:4
b) Obtain an AVL tree by inserting one data element at a time in the following
91
49
3:4
sequence: [7]
30
41
50, 55, 60, 15, 10, 40, 20, 45, 30, 70, 80.
01
02
8
OR
23
.23
ic-
16
1s
.24
0:4
b) For a given tree, Identify whether it is AVL tree or not? If it is not an AVL
91
tree, convert it into balanced AVL tree. After conversion, insert node 15
49
3:4
in the tree. Delete node 20 from the tree. After insertion and deletion
30
41
[6261]-61 3
c) Construct Heap to Sort given values in ascending order using MAXheap
8
23
sort, 5, 3, 17, 10, 84, 19, 22. [5]
ic-
(Note : Make a use of Heapify)
tat
1s
Q7) a) Differentiate between sequential file and direct access file. [6]
0:4
02 91
3:4
b) Write a pseudo code to perform the following operations on Sequential
0
41
file : [6]
1/0 13
0
i) Insert record
5/2
.23 GP
8
C
23
c) What are the characteristics of good hash function? List different
ic-
techniques to resolve collision in hash table and explain any one with
16
tat
suitable example. [5]
8.2
1s
OR
.24
0:4
91
49
3:4
Q8) a) Explain the Index sequential file organization with advantages and
30
disadvantage. [6]
41
01
02
examples. [6]
GP
1/0
c) What is File? Differentiate between text file and binary file. [5]
CE
82
8
23
.23
ic-
16
tat
8.2
1s
.24
… … …
0:4
91
49
3:4
30
41
01
02
5/2
GP
1/0
CE
82
.23
16
8.2
.24
49
[6261]-61 4