Data Structures
CSE · Midterm · Spring 24
Batch ALL
Read the questions as text
Read off the PDF by AI, so it may have mistakes. The PDF is the original.
Daffodil International University
Department of Computer Science and Engineering
Faculty of Science & Information Technology
Midterm Examination, Spring 2024
Course Code: CSE123, Course Title: Data Structures
Level: 1 Term: 2 Batch: ALL
Time: 1.5 Hours
Marks: 25
Answer ALL Questions
[The figures in the right margin indicate the full marks and corresponding course outcomes. All portions of each question must be answered sequentially.]
1 | Consider the following figure of a doubly link list: | 4 | CO2
[Figure: Doubly linked list diagram showing head pointing to node with data 7, prev pointer null, next pointing to node with data 8, then node with data 11, with arrows showing bidirectional links] | 3 | CO2
| 3 | CO2
| 2 | CO1
The Node shown above has data of type integer and prev and next as pointer of the same type.
Answer the following questions:
(A) Define the node and write required code to implement the scheme shown in the above figure.
(B) Suppose a new node having data 11 is to be inserted after the node having "7". Draw the connection scheme for the new node and write the required code to insert in this doubly link list shown.
(C) Suppose you need to delete the node having data 11. Show the deletion operation with required code.
(D) Why doubly link list is useful for computing.
2 | Consider the following figure of two link list lst1 and lst2: | 3 | CO2
[Figure: Two linked lists lst1 and lst2 with nodes containing integer values and pointers]
Write required code using C language to join this two list to make a third list named lst3.
3 (A) | Consider the following infix expressions:
a) 2^2 + 6 / 3 - 2 * 3
b) 4 / 2 - 3 + 2 * 4 | 5 | CO2
5 | CO2
(A) Convert the above infix expressions into postfix expression and evaluate using Stack. During the process demonstrate each of the stack content both for conversion and evaluation.
(B) Consider the following process diagram:
[Figure: Books in packing flow diagram]
Based on your understanding of the above business scenario, where books are in the packing flow, propose data structure to use to simulate the above business scenario. Please feel free to do necessary assumptions to justify your answer.