Data Structure and Algorithm_Assignment
Data Structure and Algorithm_Assignment
Assignment no. 1
Q1. Write algorithms for infix(in-order), prefix (pre-order) and postfix (post-order) traversal of a Tree.
Q2. What are the maximum and minimum heights of a tree with 28 nodes?
Q3. In a binary tree, what is the maximum number of nodes that can be found
in level 3?
In level 4?
In Level 12?
Q5. Show the depth first traversals (preorder, in-order, and post-order) of the binary tree in above figure
Q6. Find the infix, prefix, and postfix expressions in the expression tree of Figure
Q7. Draw the expression tree and find the prefix and postfix expressions for the following infix
expression:
(C + D + A × B) × (E + F)
Q8. Draw the expression tree and find the infix and postfix expressions for the following prefix
expression:
×-AB+×CD/EF
Q9 Draw the expression tree and find the infix and prefix expressions for the following postfix
expression:
AB×CD/+EF-×
Q10. Create a binary search tree using the following data entered as a sequential set:
14 23 7 10 33 56 80 66 70
i- Insert 44 and 50 into the tree created in Q10.
ii- Delete the Node 33 and 14 form trees created in Q10.
iii- Analyze the time and space complexity of BST
iv- Write the Algorithm to find Smallest Node in a BST
v- Write the Algorithm to find Greatest Node in the BST
Q11. Create an AVL tree using the following data entered as a sequential set. Show the balance factors
in the resulting tree:
14 23 7 10 33 56 80 66 70
i- Insert 44 and 50 into the tree in Q11.
ii- Write an Algorithm to insert element into AVL Tree.
iii- Write an Algorithm to delete element from AVL Tree.
iv- Analyze the time and space complexity of AVL Tree.
Submission Guidelines:
Write your answers neatly on A4 size paper.
Show all your work, including diagrams and algorithms.
Submit your handwritten assignment to your instructor on December 21, 2024
Clearly write your name, student ID other required detail on the title page.
Remember to ask your instructor if you have any questions or need further clarification.