CS2003 DS Lab-8 Binary Tree Traversal
CS2003 DS Lab-8 Binary Tree Traversal
Q1. Recall that inorder traversal of a binary expression tree gives infix notation of the
expression.
A+B
+
A B
Q2. A. Construct a binary tree T given either {preorder and inorder} or {postorder and
inorder} traversals of the tree.
B. Print height of the tree T that you have constructed. Write your own function for
determining height of the tree.
C. Write a function checkCousins(x, y) that checks whether two nodes in the tree T
are cousins. (nodes in the same level but having different parent)
C
A B
D E F G
Cousins : (D, F) (E, F) , (D,G), (E, G)