You are on page 1of 1

Assignment:

Trees 1

1. Implement recursive constructTree() function for generic tree.


2. Implement levelOrderPrint()[using queue], preorderPrint()[recursive],
postorderPrint()[recursive] for generic tree.
3. Find the node with largest data in a generic tree
4. Print all the elements at depth K in a generic tree
5. Find number of Nodes greater than the root in generic tree
6. Find the node for which sum of the data of all children and the node itself
is maximum in generic tree. Implement both methods discussed in class.
7. Create a Binary Tree Class with following methods
a. Void constructTree()
b. void inorderPrint()
c. void postorderPrint()
d. void preorderPrint()
e. void levelorderPrint()
f. int getHeightofTree()
g. Node * findElement(int x)
8. Given a binary tree find sum of all the nodes
9. Given a Binary tree check if it is balanced i.e. depth of the left and right
sub-trees of every node differ by 1 or less
10. Given a binary tree, create another tree which is mirror of the
provided tree.
11. Given two binary trees, return true if they are structurally identical
they are made of nodes with the same values arranged in the same way.
12. Count number of leaf nodes in the binary tree.

You might also like