ASSIGNMENT-4 Tree
ASSIGNMENT-4 Tree
1. If the Inorder of a binary tree is B,I,D,A,C,G,E,H,F and its post order is I,D,B,G,C H,F,E,A then
draw a corresponding binary tree with neat and clear steps from above assumption.
(BCS-301.3, K3)
2. Insert the following sequence of elements into an AVL tree, starting with empty tree
71,41,91,56,60,30,40,80,50,55 also find the minimum array size to represent this tree.
(BCS-301.3, K2)
4. What is the difference between a binary search tree (BST) and heap? For a given sequence of
numbers, construct a heap and a BST.
34, 23, 67, 45, 12, 54, 87, 43, 98, 75, 84, 93, 31
(BCS-301.3, K3)
5. What is a B-Tree? Generate a B-Tree of order 4 with the alphabets (letters) arrive in the sequence
as follows:
AGFBKDHMJESIRXCLNTUP
(BCS-301.3, K3)
6. Can you find a unique tree when any two traversals are given? Using the following traversals
construct the corresponding binary tree:
INORDER: H K D B I L E A F C M J G
PREORDER: A B D H K E I L C F G J M.
Also find the Post Order traversal of obtained tree. (BCS-301.3, K3)
7. Consider the following AVL Tree and insert 2, 12, 7 and 10 as new node. Show proper rotation to
maintain the tree as AVL. (BCS-301.3, K3)
8. What maximum difference in heights between the leafs of a AVL tree is possible?
a) log(n) where n is the number of nodes
b) n where n is the number of nodes
c) 0 or 1
d) at most 1
(BCS-301.3, K3)
9. Construct an AVL Trees with the values 1to 10 numbers into an initially empty binary tree.
(BCS-301.3, K3)
10. Differentiate between fixed length and variable length encoding. Draw a Huffman tree for the
following symbols whose frequency of occurrence in a msg is stated along with the symbol below
: A : 15, B : 6, C : 7, D : 12, E : 25, F : 4, G : 6, H : 1, I : 15 Decode the message
1110100010111011 (BCS-301.3, K3)