Dsa Assignment 2 2024
Dsa Assignment 2 2024
7. With suitable example , Explain step for conversion of a general tree into binary tree.
a) J, R, D, G, T, E, M, H, P, A, F, Q
b) MAR, MAY, NOV. AUG, APR, JAN, DEC, JUL, FEB, JUN, OCT, SEPT
9. The following numbers are inserted into an empty binary search tree in the given
order : G, C, B, A , D, E, F, I, H. Construct tree step by step. Represent the constructed
tree using static memory allocation.
10. Explain Threaded Binary Tree with its advantages and disadvantages.
12. Let characters a, b, c, d, e, f has probabilities 0.07, 0.09, 0.12, 0.22, 0.23, 0.27
respectively. Find an optimal Huffman code and draw Huffman tree.
13.
a) From the given traversals construct the binary tree :
Inorder : EICFJBGDKHL postorder : IEJFCGKLHDB
Draw the binary tree and write preorder traversal.
c)
Generate binary tree for the following pre-order and in-order traversals :
Pre-order : E A C K F H D B G
In-order : F A E K C D H G B
d)
14. Construct threaded binary tree step by step if the preorder traversal is G, B, D, C, A,
K, Q, P, R & in-order traversal is B, A, C, D, G, K, P, Q, R. Delete G and redraw a tree.
15. Solve following Tree traversal examples. Perform inorder , preorder and postorder
traversal of binary tree.
1. 2.
3. 4.