Data Structure and Algorithm
Data Structure and Algorithm
Data Structure and Algorithm
(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.
(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
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
Page 2 of 2