Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

Recipe

Classify a binary tree as full, perfect, or complete

Use when: you're given a specific binary tree's shape and asked whether it's full, perfect, or complete

Goal: a correct classification, backed by the specific vertex or level that fails whichever test it fails

Taught in Binary trees

  1. 1

    Visit every vertex and count its children. If even one vertex has exactly one child, the tree fails to be full immediately.

    Example

    A root has two children; the left child has two children of its own, and the right child is a leaf. Every vertex has 0 or 2 children: the root (2), the left child (2), the right child (0), and both grandchildren (0 each).

    • some vertex has exactly one child — not full, and therefore not perfect either; skip Step 2, but still test complete in Step 3.
    • every vertex has 0 or 2 children — full; continue to Step 2 to test perfect.

    Why: full is defined exactly by ruling out the single-child case at every vertex, so one offending vertex is enough to fail it.

  2. 2

    For a tree that passed Step 1, list the level of every leaf. If they are all equal, the tree is also perfect.

    Example

    Continuing the tree above, the two grandchildren are leaves at level 2, but the right child, also a leaf, sits at level 1. The leaf levels are not all equal.

    • leaf levels are all equal — perfect, and therefore also complete.
    • leaf levels differ — full but not perfect; continue to Step 3 to test complete separately.

    Why: perfect is full plus a stronger level condition, so passing Step 1 is not enough to call a tree perfect.

  3. 3

    Check each level from the root down. Every level before the last must be completely filled, and the last level's vertices must sit at the leftmost positions with no gap.

    Example

    Continuing the tree above: level 0 has 1 vertex, its full capacity. Level 1 has 2 vertices, also full capacity. Level 2 holds only the left child's two children, filled from the left with no gap, so this tree is complete.

    Why: complete only requires the last level to fill left to right, unlike perfect, which requires every leaf at the same level.

Common mistakes

  • Concluding a tree is full just because the root has two children, without checking every other vertex.
  • Assuming full automatically means perfect; leaf levels can still differ even when every vertex has 0 or 2 children.
  • Checking completeness by counting total vertices instead of checking each level's fill pattern.
  • Mixing up perfect (every leaf at the same level) with complete (last level filled left to right, possibly missing some leaves).