Skip to content
Azhimathi Mayam logoDSA Study HubPCCST303 · KTU · S3
Module 3 · syllabusAsked 1× in KTU papersLesson live

Binary trees: types and properties

At most two children per node: full, complete, skewed trees and the formulas that come up every year.

Syllabus says: “Binary Trees - Types and Properties”

On this page · 8 sections
ormakkurippu ✎
Never-forget card

Level i holds at most 2^(i−1) nodes; depth k holds at most 2^k − 1. Leaves = (nodes with 2 children) + 1.

Picture it

A WhatsApp forward where each person forwards to at most 2 friends: level 1 has 1 person, level 2 has 2, level 3 has 4… doubling every level.

Write this in the exam

A binary tree is a finite set of nodes that is either empty or consists of a root and two disjoint binary trees called the left subtree and the right subtree.

What you will be able to do

  • Define a binary tree.
  • Explain full, complete and skewed binary trees with examples (Nov 2025 Q14b).
  • State and use the binary-tree properties.

Types of binary trees

Watch outWatch the naming

Books disagree on ‘full’. Horowitz: a full binary tree of depth k has exactly 2^k − 1 nodes (every level full; also called perfect). Many other books: ‘full’ (strict) means every node has 0 or 2 children. In the exam, write the definition you are using and draw an example.

4251637
Full (perfect) binary tree of depth 3: 2³ − 1 = 7 nodes.
425163
Complete binary tree: levels 1–2 full, last level filled from the left (6 is a left child). Not full.
21637
Strictly binary (every node has 0 or 2 children) but NOT complete: positions 4 and 5 on level 3 are empty while 6 and 7 are filled.
4321
Left-skewed tree: every node has only a left child. It behaves like a linked list.

Properties (with one-line proofs)

PropertyFormulaWhy
Max nodes at level i (root = level 1)2^(i−1)each level can at most double
Max nodes in a tree of depth k2^k − 11 + 2 + 4 + … + 2^(k−1)
Leaves vs degree-2 nodesn₀ = n₂ + 1edges: n − 1 = n₁ + 2n₂, and n = n₀ + n₁ + n₂
Minimum depth with n nodes⌈log₂(n + 1)⌉invert 2^k − 1 ≥ n
Pro tipProof of n₀ = n₂ + 1 (write it like this)

Let n = n₀ + n₁ + n₂. Every node except the root has exactly one incoming branch, so branches B = n − 1. Every branch leaves a node of degree 1 or 2, so B = n₁ + 2n₂. Equating: n₀ + n₁ + n₂ − 1 = n₁ + 2n₂, so n₀ = n₂ + 1.

Asked in KTU exams (1)

Quick check — can you get them all?

Question 1

Q1.Maximum number of nodes in a binary tree of depth 4?

Question 2

Q2.A binary tree has 9 nodes of degree 2. How many leaves?

Question 3

Q3.All levels completely filled except possibly the last, which is filled from the LEFT. This tree is…

Practice

Every visualizer has a Practice mode: predict the next state before the animation reveals it. You can also work through the topic's question set on the practice page.

Exam-ready summary

  • Binary tree: empty, or root + left subtree + right subtree.
  • Full (Horowitz) = 2^k − 1 nodes; complete = filled left to right; skewed = one child per node.
  • 2^(i−1) per level; 2^k − 1 total; n₀ = n₂ + 1.

References

  • Horowitz, Sahni & Anderson-Freed, Fundamentals of Data Structures in C, 2/e — §5.2 (Binary trees)
  • Cormen, Leiserson, Rivest & Stein, Introduction to Algorithms, 3/e — Appendix B.5

Explanations on this page are original. Textbook references point to where the standard treatment can be read; no text is reproduced from them.

Prefer revising from notes? Module-wise notes and question papers on Azhimathi Mayam (opens in a new tab)