18CS32 April 2021
18CS32 April 2021
18CS32
USN 4S 9 es o61
Third Semester B.E. Degree Examination, Jan./Feb. 2021
Data Structures and Applications
Time: 3 hrs. Max. Marks: 100
Note: Amswer any FIVE full questions, choosing ONE full question from each module.
Module-1
1 a. Define data structures. Explain with neat block chematic different types of data structures
with examples. What are the primitive operations that can be performed? (10 Marks)
b. Define sparse matrix. Express the following matrix in triplet form and find its transpose.
(10 Marks)
15 0 0 22
0 1 30
A =|
0
00-6|
0 0-0 0
91 00 0
0 28 0
OR
2 a. Explain any four dynamic memory allocation funetions with syntax and example. (10 Marks)
b. What do you mean by pattem matching? Outline the KMP algorithm. Implement the same to
find out the occurrence of following pattern.
P:ABCDABD
S:ABC ABCDAB ABCDABCDABDE (10 Marks)
Module-2
3 a. De fine Recursion. Let A and B be nonnegative integers. Suppose a function GCD is
recursively defined on follows:
GCD(A, B) = GCD (B. A) if A < B
A ifB =0
GCD(B, MOD(A, B)) otherwise
=
OR
4 a. Write a C function CQlnsert( ) and CQDelete0 operations on
circular queue. (08 Marks)
b. Outline the algorithm for inlix to prefix. Using the same algorithm convert following INEIX
to equivalent PREFLX
(H (C(A +((BC) D)» F)* G)* E) +J) (08 Marks)
.Evaluate the following postfix expression by showing the contents ofthe stack
546+*493/+* (04 Marks)
I of 3
5 a.
- S U
- S
0 0 5 7 0
A =
0 00 0 0
0 2 6 0 0
OR
6 a. Write C function to addtwo polynomials. Show the linked list representation of below two
polynomials and in additton.
POLY 1:5x+ 4x
POLY 2:3x + 5 (08 Marks)
b. Write C functions for following operations.on circular linked list:
i) Insetion at the beginning
ii) Inserion at the end
i) Deletion at the beginning
iv) Deletion at the end.
SU 8pl
8pm (12 Marks)
1 a.
Module-4
Define Binary tree wittanekample. Write Crecprsive routine toraverse the given tree
using inorder, preorder and postorder. (08 Marks)
b. Define binary searçh tree. Draw the BST t h efollowing inpu
14 15 4 9 7 1835 16 20 17 9
Give recursive search function to searchan element in that tree/ (06 Marks)
c. Given the following traversal, draw'abináry tree:
i) Inorder:42516738 -S U
Postórder:4 526783 1
ii) Préorder: A BCE IFJD GHKL
Inorder EICFJBGDK HLA (06 Marks)
OR
8 aRepresent the below givén tree in Fig.Q.8a), using
i) Linked list representation
ii) Left childright sibling repre[cniation. (08 Marks
SU
S U
- S
SU-
Fig.Q.8(a)
S U
2 of 3
SU
pm
I8CS32
202g01: SU
b. Detine threaded binary tree. List its advantages
anddishdvantages. Draw the one way
threading and two way threading ofthe following binarytee. (Refer Fig.).8(b). (0% Marks)
01:0
02
De fine the
Module-5
9 a. following teminologies with examples:
i) Digraph )Weighted graph ii) Selfloop iv) Parallel edges (08 Marks)
6. Give the adiacèncy matrix, incidence matrix and linked list representation of the following
undirected graph. (06 Marks)
S U
ey
FigO9b)
Arrange the folowing elements in ascending order using RADIX SORT
151,60, 875, 34212,477, 689, 128 (06 Marks)
7-04-2
07-04-2
OR
10 a. Explain different types of HASHfúnction with example. (10 Marks)
b. Explainany five file operations álong with syntaxand example. (10 Marks)
**
SU
U -SU
SU
-SU-
SU
3 of3