0% found this document useful (0 votes)
18 views4 pages

2024 May Dsa-Pattern-2019

Uploaded by

Preet Jain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views4 pages

2024 May Dsa-Pattern-2019

Uploaded by

Preet Jain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Total No. of Questions : 8] SEAT No.

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

3) Figures to the right indicate full marks.


4) Assume suitable data, if necessary.
E
82

8
C

23
ic-
Q1) a) Imagine we have two empty stacks of integers, S1 and S2. Draw a picture
16

of each stack after the following operations: [6]

tat
8.2

1s
i) S1. Push (3);
.24

ii) S1. Push (5);


0:4
91
iii) S1. Push (7);
49

3:4
iv) S1. Push (9);
30
41

v) S1. Push (11);


01
02

vi) S1. Push (13);


5/2
GP

vii) while (! Emptystack (S1))


1/0

{
CE

X = S1. Pop ();


82

first time infix to prefix asked, infix

8
23
X = S1. Pop (); to postfix most common
.23

S2. Push (X);


ic-
16

tat
}
8.2

1s
.24

0:4
91
49

3:4

b) Clearly indicate the content of stack during conversion of given infix


30

expression to prefix.
41

A^B*C–D+E/F/(G+H) [6]
01
02

c) Write a C++ pseudocode algorithm for the following operation of simple


5/2
GP

queue using linked representation. [6]


1/0

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

ii) Two letters are deleted


iii) K, L, M are added to the queue
E
82

iv) R is added to the queue

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

Explain enqueue and dequeue operations of double ended queue. [6]


41
01
02

Q3) a) Create a binary tree from given preorder and inorder traversal. Show all
5/2
GP

intermediate steps. [6]


1/0

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

100, 50, 200, 300, 20, 150, 70, 180, 120, 30


41

Show all steps.


01
02
5/2
GP

OR
1/0

Q4) a) Write C++ pseudocode algorithm for preorder traversal of threaded


CE
82

binary tree. [6]


.23

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

concern tree. [6]


8.2

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

Label the rotations appropriately at each stage


5/2
GP

c) Write short note on OBST [5]


1/0
CE
82

8
OR

23
.23

ic-
16

Q6) a) Write an application of Topological sorting with suitable example. [6]


tat
8.2

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

operation, if the tree is imbalanced, make it balanced AVL tree. [7]


01
02
5/2
GP
1/0
CE
82
.23
16
8.2
.24
49

[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

ii) Delete record


E
82

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

b) Explain Linear probing with and without replacement with suitable


5/2

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

You might also like