# Binary Tree

Given the pre-order and in-order traversal of a Binary Tree. Construct the tree from these traversals. InOrder: 1 4 5 8 10 30 40 PreOrder: 10 5 4 1 8 30 40 Can you construct the Tree if only post-order and in-order traversals are given? Can you construct a tree if only pre-order and post-order […]

If the node of a Binary tree is defined as below: struct Node{ Node * lptr; // Pointer to Left subtree int data; Node *rptr; // Pointer to Right subtree }; write functions which will traverse the tree in in-Order, Pre-Order and Post-Order.

Given a Binary Tree and a numberĀ x, Write a function to see if there exist a root to leaf path in the tree whose sum is equal to x.

Write a function to count the leaf nodes of a binary tree.

Given pointers to the root of two Binary Trees, write code to check if first Binary tree is subtree of second binary tree. The signature (prototype) of the function should be /** returns 1 (true) if Binary Tree a is subtree of Binary tree b , * else returns 0(false) */ int checkSubTree(struct Node* a, […]

Given a Binary Search Tree (BST), where will you find the node containing minimum value in the Tree? For example: If the tree is as given below Then answer is 1. Write a function that returns the least value in given BST.

A Sum-Tree is a Binary tree, where each non-leaf node has a value equal to the sum of its children. For example: the below tree is a Sum-Tree. Write a function that checks whether a given tree is a Sum-Tree or not.

Given a pointer to the node in a binary tree, write code to find its inorder successor. You may assume each node to also have a pointer to the parent node (along with pointer to right and left sub-trees). Hence, the structure of Node will be struct Node { int data; Node* lptr; // pointer […]