Non-leaf nodes of a binary tree

Write a function that will return the number of non-leaf nodes in a binary tree. For example: The below binary tree A / \ B […]

Making tree from traversals

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: […]

Basic Tree Traversals (Preorder, Inorder, Postorder)

If the node of a Binary tree is defined as below: struct Node{ Node * lptr; // Pointer to Left subtree int data; Node *rptr; […]

Has Path Sum (binary tree)

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 […]

Counting leaf nodes of a Binary Tree

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

Check if a Binary tree is sub-tree of another

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 […]

Node with minimum value in a Binary Search Tree

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 […]

Check if a Binary Tree is a Sum Tree or not

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 […]

Inorder successor of node in a Binary Tree

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 […]