0% found this document useful (0 votes)
22 views2 pages

Data Structure and Algorithm

Uploaded by

Anagha Bhattad
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)
22 views2 pages

Data Structure and Algorithm

Uploaded by

Anagha Bhattad
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/ 2

Course Code: CST252

Third Semester BE (Computer Science and Engineering) Examination


Data Structure and Algorithm
Time: 2 Hours] [Max. Marks: 40
Instructions to Candidates:
1. All questions are compulsory.
2. Stepwise explanation will be appreciated
Question Description of Question Marks CO

1 (a) Consider a structure Array is declared as: 3 CO1


struct Array
{
int *A;
int length;
int size;
}
“A” stores array of integers, “length” stores number of elements in
the array and “size” stores memory allocated to array. Write a C
function to delete all the duplicate entries from the above specified
array.
(b) Consider array stores marks of 30 students in 4 subjects. Row 3 CO1
represents subjects and Columns represents students. Base
Address of the array is 2500. Lower bound for row and column is
0.
a. Compute the address of marks[3][5] in row major order.
b. Compute the address of marks[2][20] in column major
order.
2 (a) Consider a Stack ADT is already created. Write a function to check 3 CO1,
whether the parentheses are balance or not.
CO2
Balanced Parentheses : ( ( ) ( ) ( ( ) ) )
Unbalanced Parentheses: ( ( ) ( ) ( ( ) )

(b) Design a C program for storing two queues stored in one array. 4 CO2
Queue1 grows from left to right and Queue2 grows from right to
left. Properly specify the overflow and underflow conditions for
both the queues.

3 (a) Consider an integer linked list is already created. Write a C 4 CO2


function to delete all the negative numbers from the linked list.

(b) Write an algorithm to interchange the kth and the (k+1)th node of a 3 CO2
doubly linked list. Ensure that the nodes are swapped and not
just values.
Note: kth node cannot be the last node.

Page 1 of 2
4 (a) A company maintains an array of employees which stores 3 CO3
employee name, employee id and salary. The array is always kept
in sorted order according to employee ID. Design a C function
which will search and display the details of a particular employee
when the employee ID is specified.

(b) Consider a hash table with size = 11. Using double hashing, insert 3 CO3
the keys 27, 72, 63, 42, 44, 36, 38 and 101 into the table. Take h1 = k
mod 10 and h2 = k mod 8.

5 (a) Construct a B+ tree of order 5. The numbers are inserted in the 3 CO4
sequence given below:
80, 40, 15, 25, 30, 90, 35, 50, 60, 70

(b) Consider a Binary tree is already created. Write a C function to 4 CO4


check whether the root node is balanced or not.

6 (a) Consider four cities: (1) New Delhi, (2) Mumbai, (3) Chennai, and 5 CO4
(4) Bangalore, and a list of flights that connect these cities as
shown in the following table. Use the given information to
construct a graph. Using Dijkstra’s algorithm, find the shortest
path to each node from New Delhi

Flight No. Origin Destination Cost


101 1 4 5
102 4 1 4
103 1 2 2
104 1 3 6
105 3 1 4
106 2 3 3
107 3 4 1
108 4 3 12

(b) Explain the following terms: 2 CO4


a) Complete Graph
b) Strongly connected directed graph

Page 2 of 2

You might also like