School of Computer Science and Engineering
Winter Semester 2024-25
Subject Code: CSI2002 Subject Name: Data Structures and Algorithm Analysis
Semester: Winter Semester 2024-2025 Slot : B1 & B2
Tutorial Problems
1. Construct the binary tree from the following tree traversal
Post order: 84526731
Inorder: 48251637
Preorder: 12485367
Inorder: 48251637
2. Find the In-order, Pre-order and Post-order traversal for the
following binary tree.
3. Construct the expression tree from the given expression
i) ab+cde+**
ii) a+(b*c)+d*(e+f)
4. Construct the BST with the following elements and do the following
operations: 30,40,24,58,48,26,11,13.
Delete 13
Insert 25
Delete 24
Delete 58
5. Consider a queue, which is initially empty. Find front and rear
positions after each operation.
i) Insert 11,22,33
ii) Delete two consecutive elements
iii) Insert 44,55
iv) Insert 66
Assume maxsize is 5 and array index start from 0.
Command Linear queue Front Rear
(Initial)Empty Draw the appropriate Linear -1 -1
queue queue here
6. Assume that the operation ENQUEUE (CQ, x) inserts an item x into
a circular queue CQ and another operation DEQUEUE (CQ) deletes
an item from CQ in FIFO manner. Draw the circular queue of size 6
Illustrate the working for the following eight commands (in the
given order) over that circular queue with a neat diagram. Also give
the values of the variables FRONT and REAR on execution of each
command;
ENQUEUE (CQ, 5);
ENQUEUE (CQ, 10);
ENQUEUE (CQ, 15);
DEQUEUE (CQ);
ENQUEUE (CQ, 20);
ENQUEUE (CQ, 25);
ENQUEUE (CQ, 30);
DEQUEUE (CQ);
Command Circular queue Front Rear
ENQUEUE(CQ,5) Expected to draw the 0 0
appropriate circular queue
here
7. Construct the binary tree from the following tree traversal
Preorder: ABCEIFJDGHKL
Inorder: EICFJBGDKHLA
8. Given a sequence of numbers ‘ARR’. Your task is to return a sorted
sequence of ‘ARR’ in non-descending order with help of the merge
sort algorithm. 8 3 4 6 1 5 7 2
9. Consider the following unsorted list: 95 79 19 43 52 3. Write the
passes of bubble sort for sorting the list in ascending order till the
3rd iteration.
[Link] insertion sort and selection sort to sort the
following elements:
45, 67,28,7,56,47,28
Display the 3rd and 5th iteration of insertion
sort and selection sort.