0% found this document useful (0 votes)
8 views

Trees Questions

The document contains a series of important questions related to trees in computer science, including definitions and algorithms for various types of trees such as binary trees, threaded binary trees, AVL trees, and B-trees. It also includes tasks for constructing trees based on given traversals, as well as questions about Huffman trees and their algorithms. Additionally, the document discusses the advantages and applications of different tree structures.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Trees Questions

The document contains a series of important questions related to trees in computer science, including definitions and algorithms for various types of trees such as binary trees, threaded binary trees, AVL trees, and B-trees. It also includes tasks for constructing trees based on given traversals, as well as questions about Huffman trees and their algorithms. Additionally, the document discusses the advantages and applications of different tree structures.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

UNIT 5

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.

Q2.Draw a binary tree with following traversals:


Inorder: B C A E G D H F I J
Preorder: A B C D E G F H I J

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.

Q4.Make a binary tree using: INORDER - Q B K C F A G P E D H R, POSTORDER-


GBQACKFPDERH

Q5.For the following expression ((a*x+b)*x+e)*x+f.


Construct the expression tree. Also evaluate in Postfix Notation.

Q6.What is huffman tree? Create a huffman tree with following no.s-


24, 55, 13, 67, 88, 36, 17, 61, 24, 76.

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.

Q8.Construct an expression tree for the following algebraic expression:


(3a-b) ^ 2(4c + 2d) ^3.

Q9.Draw a binary Tree for the expression: A * B - (C + D) * (P /Q)

Q10. Number of nodes in a complete tree is 100000. Find its depth.

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

Q13. Construct the binary tree for the following.


In-order: Q, B, K, C, F, A, G, P, E, D, H, R
Preorder: G, B, Q, A, C, K, F, P, D, E, R, H
Find the Post Order of the Tree

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.

Q20. Draw a binary tree with following traversals: Inorder: B C A E G D H F I J Preorder:


ABCDEGFHIJ

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

Q23. What are the advantages of B + tree over B- 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

Q26. Make a binary tree using: INORDER -Q B K C F A G P E D H R POSTORDER


-G B Q A C K F P D E R H
Q27. What is AVL tree? Make an AVL tree for the given sequence 50 33 44 77 35 60 40

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?

Q38. What are the advantages and disadvantages of binary tree?

You might also like