Assignment 4 ( Tree) BCS301
Assignment 4 ( Tree) BCS301
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.
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.
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
5. What is a B-Tree? Generate a B-Tree of order 4 with the alphabets (letters) arrive in the sequence as
follows:
AGFBKDHMJESIRXCLNTUP
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.
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.
8. Define AVL Trees. Explain its rotation operations with examples. Construct an AVL Trees with the values
10 to 1 numbers into an initially empty binary tree.
9. 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