Data Structures Mid Sem QP
Data Structures Mid Sem QP
Question 1 [4 Marks]
return C
Question 2 [4 Marks]
Write an algorithm to delete data from start to end positions in a Doubly Linked List (DLL) that
contains 10 data where start and end positions are not 1 and 10.
Example:
Let us assume that there are 10 data as
1 2 3 4 5 6 7 8 9 10
If the start and end positions are 2 and 6, the resultant list contains
1 7 8 9 10
Question 3 [6 Marks]
(i) Convert the expression A-(B/C+(D%E*F)/G)*H to prefix form with and without using stack.
(ii) Evaluate the given postfix expression 9 3 4 * 8 + 4 / -
Question 4 [6 Marks]
There are 'N' numbers of balls in the box. The colours of the balls are red and blue. You are requested to
stack the balls in the bottom sealed basket one by one. The order of placing the balls is two consecutive
red balls, followed by the two consecutive blue balls. Later, Create two empty queues Q1 and Q2.
Remove the last inserted ball from the basket and place it in Q1. Similarly remove the next ball from the
basket and insert in Q2. Develop a C program to repeat this process until the basket is empty and also
print the colour of the balls in both queues.
Question 5 [6 Marks]
Question 6 [4 Marks]