Properties of Binary Tree (original) (raw)

Last Updated : 24 Mar, 2025

This post explores the fundamental properties of a binary tree, covering its structure, characteristics, and key relationships between nodes, edges, height, and levels

Binary tree representation

**Note: Height of root node is considered as 0.

**Properties of Binary Trees

**1. Maximum Nodes at Level 'l'

A binary tree can have at most **2 lnodes at level **l.

**Base case: For root (**l = 0), nodes = 20 = 1.

**Inductive step: If level **l has 2l nodes, then the next level has at most **twice as many:

**2×2 l **= 2 l+1

**2. Maximum Nodes in a Binary Tree of Height 'h'

A binary tree of height **h can have at most **2 h+1 - 1 nodes.

**Formula Derivation: A tree has the **maximum nodes when all levels are completely filled. Summing nodes at each level:

**1 + 2 + 4 +...+ 2 h = 2 h+1 - 1

**3. Minimum Height for 'N' Nodes

The minimum possible height for **N nodes is **⌊log⁡ 2 N⌋.

**Explanation: A binary tree with height **h can have at most **2 h+1 **- 1 nodes.

Rearranging:

N ≤ 2h+1 − 1
2h+1 ≥ N+1
h ≥ log2​(N+1) - 1 _(Taking log 2 both sides)
h ≥ ⌊log2​N⌋

This means a binary tree with **N nodes must have at least ⌊log⁡ 2 N⌋ levels.

**4. Minimum Levels for 'L' Leaves

A binary tree with **L leaves must have at least **⌊log⁡ 2 L⌋ levels.

**Why? A tree has the **maximum number of leaves when all levels are fully filled.

**From Property 1:
L ≤ 2l ( **l is the level where leaves appear)

Solving for **l:
lmin = ⌊log⁡2L⌋

This gives the **minimum levels needed to accommodate L leaves.

**5. Nodes with Two Children vs. Leaf Nodes

In a **full binary tree (where every node has either 0 or 2 children), the number of **leaf nodes (L) is always one more than the internal nodes (T) with two children:

L=T+1

**Proof:

A full binary tree has a total of 2h+1 - 1 nodes.

Leaves are at the last level: L = 2h.

Internal nodes: T =2h (2−1) − 1= 2h - 1.

Simplifies to **L=T+1

**6. Total Edges in a Binary Tree

In any **non-empty binary tree with **n nodes, the total number of edges is **n - 1.

Every node (except the root) has exactly **one parent, and each parent-child connection represents an **edge.

Since there are **n nodes, there must be **n - 1 edges.

**Additional Key Properties

**Node Relationships

**Types of Binary Trees

**Tree Traversal Methods

Tree traversal is categorized into **Depth-First Search (DFS) and **Breadth-First Search ****(BFS):**

See Handshaking Lemma and Tree for proof
Different types of Binary Trees and their properties
Introduction to Binary Tree in set 1