**Objective:** Given a Binary tree, Find the size of the tree.

Note : Size of the tree is number of nodes in the tree

**Input:** A Binary Tree.

**Output: **Size of the tree.

Example :

Size of Binary Tree example

**Approach :**

- Very Simple solution
- Start from the root.
- Size = 1 (for the root) + Size Of left Sub-Tree + Size Of right Sub-Tree
- solve the left sub-tree and right sub-tree recursively.

Size of Binary Tree Implement

**Time Complexity : O(n)**

**Complete Code:**

**Output**:

Size of the Tree is : 7

__________________________________________________

**Top Companies Interview Questions..-**

If you find anything incorrect or you feel that there is any better approach to solve the above problem, please write comment.

__________________________________________________

### Like this:

Like Loading...

*Related*