Data Structures
CSE · Midterm · Fall 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
Faculty of Science & Information Technology
Department of Computer Science and Engineering
Midterm Examination, Fall 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:
[Figure: A doubly linked list with a head pointer pointing to a node containing data 7, prev pointer null, next pointing to the next node containing 9. A separate temp node containing data 11 is shown below with prev and next pointers.]
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 the required code to implement the scheme shown above. | 4 | CO2
(B) Suppose the 'temp' 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 it into the doubly link list shown. | 4 | CO2
(C) Suppose you need to delete the node having data 11. Show the required deletion code. | 3 | CO2
(D) Why is a doubly link list preferred over a single link list? | 2 | CO1
2. Consider the following figure of two link list lst1 and lst2:
[Figure: Two linked lists lst1 and lst2 sharing shape nodes containing x and y data, and next pointer]
Write the required code using C language to define the Shape node. | 5 | CO2
3. (A) Consider the following infix expressions:
(i) 3^2 + 6/3 - 3 x 2
(ii) 6/3 + 2 x 3 - 4
Convert the above infix expressions into prefix and postfix expressions. Also shows the conversion of expression (i) into postfix using Stack. During the process demonstrate each of the stack content. | 5 | CO2
(B) Why stack is widely used in computing. | 2 | CO2