Trees Questions
Trees Questions
Trees
Important Questions
Q1.Define tree, binary tree, complete binary tree. Write algorithms or function to obtain
traversals of a binary tree in preorder, post order and in order.
Inorder: D J G B A E H C F I
Preorder: A B D G J C E H F I.
Inorder: DBHEAIF.I CG
Preorder: ABDEHCFIJ G
Inorder: DBHEAIFJCG,
Preorder: ABDEHCFIJ G
Q3.What is a Threaded Binary Tree? Explain the advantages of using a threaded binary tree.
Q7.The order of nodes of a binary tree in inorder and post-order traversal are as following:
In-order : B, I, D, A, C, G, E, H, F. Post-order: I, D, B, G C, H, F, E,A.
Draw the corresponding binary tree.
Q11. Explain Huffman algorithm. Construct Huffman tree for MAHARASHTRA with its
optimal code.
Q12. What is a height balanced Tree? Why height balancing of Tree is required? Create an
AVL Tree for the following elements: a, z, b, y, c, x, d, w, e, v, f
Q14. Construct a B-tree of order 5 created by inserting the following elements 3, 14, 7, 1,
8, 5, 11, 17, 13, 6, 23, 12, 20, 26, 4, 16, 18, 24, 25, 19 Also delete elements 6, 23 and 3
from the constructed tree.
Q15. Suppose the following list of letters is inserted in order into empty binary search tree:
J, R, D, G, T, E, M, H, P, A, F, Q (i) Construct the binary Search Tree (ii) Find the
in-order, Pre-order and Post-order Traversal of the BST created.
Q16. Discuss the advantages of using B-Tree. Insert the following Information 86, 23, 91,
4, 67, 18, 32, 54, 46, 96, 45 into an empty B-Tree with order 4.
Q17. Construct the binary tree using following in-order and post-order traversal. In-order :
DBMINEAFCJGK Post-order : ABDEIMNCFGJK
Q18. Differentiate between fixed length and variable length encoding. Draw the Huffman
tree for the following symbols whose frequency of occurrence in message is stated along
with symbol below A:15, B:6, C:7, D:12, E:25, F:4, G:6, H:1, I:15 Decode the message:
1110100010111011
Q19. Construct a B-tree on following sequence of inputs. 10, 20, 30, 40, 50, 60, 70, 80, 90
Assume that the order of the B-tree is 3.
Q21. Consider the following AVL Tree and insert 2, 12, 7and 10 as new node. Show proper
rotation to maintain the tree as AVL.
Q22. What is a Threaded Binary Tree? Explain the advantages of using a threaded binary
tree
Q24. What is binary search tree? Write the important applications of binary search tree.
Write algorithm to delete a node from a binary search tree.
Q25. What is binary search tree? Make a binary search tree for following sequence: 8 7 17
25 23 6 9 2 15 22 12 1
Q28. What is the maximum height of any AVL tree with 7 nodes?
Q29. Describe all rotations in AVL tree. Construct AVL tree from the followings nodes: B,
C, G E, F, D,A
Q30. Explain binary search tree and its operations. make a binary search tree for the
following sequence of numbers, show all steps: 45,32,90, 34,68,72,15,24, 30, 66 ,l11, 50,
10.
Q31. Define a B-Tree. What are the applications of B-Tree? 1 Draw a B-Tree of order 4 by
insertion of the following keys in order: Z, U,A, I, W I;R X,C,J, D, M,I B, Q, E, H,
S,K,N,R,G,Y,F,O,V
Q32. Construct BST for following values: 49,22,25, 90, 82, 7, 13, 47, 49, 43.
Q33. Construct AVL Tree with following nodes. 35, 36, 80, 85, 67, 89, 25, 16,10, 14, 14.
Q34. Construct B tree using numbers 65, 71, 70, 66, 75, 68, 72, 77, 74, 69, 83, 73,82, 88,
67, 76, 78, 84, 85, 80.
Q35. Write an algorithm for preorder traversal in a tree. Determine the binary tree for the
following traversal
Inorder- B,I,D,A,C,G,E,H,F Post order- I,D,B,G,C,H,F,E,A
Q36. What is Huffman Tree? Draw a Huffman tree with Algorithm for following symbol
whose frequency of occurrence in a message is stated along with the symbol below: A:6
B:7 C:12 D:6 E:25 G:4 H:10 J:35 K:15
Q37. If there are 27 nodes in a complete binary tree, what will be its height and how many
nodes will be in the last level?