Ibadat International university Pakpattan campus
Department of Computer Science
Subject: Data Structure Due Date: 26-11-24
Subject Teacher: Dr. Lal Khan Total marks: 30
Assignment #1
Instructions:
1. The assignment after due date will not be accepted.
2. Copying of assignment from any source, internet, ChatGPT or from your fellows is not
allowed, in case of copying student will be graded with Zero marks.
Q#1: You are required to implement a Stack using a Linked List and a Queue using an Array in Java.
Additionally, you must insert at least 10 elements into each data structure. For example, you can insert
10 book names into the stack and 10 person names into the queue.
Once the elements are inserted, you should perform 10 push operations to add elements onto the
stack. Afterward, remove half of the elements from both the stack (using the pop operation) and the
queue (using the dequeue operation).
Finally, you must display the contents of the stack and queue both after the insertion and after the
removal operations to check the status of the data structures. [10]
Q#2: Convert this infix expression to post fix using stack (2-3+4)*(5+6*7) [10]
Q#3: Insert the following elements in the binary tree.
50, 70, 35, 20, 40, 60, 80, 25 and then delete 70, after deletion of the element 70 what will be the
shape of remaining binary tree. Then re draw the tree after deleting the element 35 [10]