Trees

Binary Tree Types

Three Types

Full Binary Tree
Degenerate / Skewed
Complete Binary Tree

Visual Comparison

Full Binary Tree

In a Full Binary Tree, there's no such thing as a node with just one child — every node has either zero children or exactly two. That strict rule keeps the tree evenly shaped, with leaves sitting at the same level or one level apart, which makes it a good starting point for understanding how balanced trees behave.

Degenerate (Skewed) Tree

A Degenerate, or Skewed, Tree is what you get when every parent node has only a single child — at that point it's really just a linked list wearing a tree's name. This is the worst case for height, Θ(n), and it typically happens when you insert already-sorted data into a binary search tree with no rebalancing, which tanks the performance benefits a tree is supposed to give you.

Complete Binary Tree

A Complete Binary Tree fills every level entirely except possibly the last one, and even that last level has to fill up left-to-right with no gaps. That predictable, gap-free shape is exactly what heaps are built on, since it guarantees a compact height and keeps operations efficient.

Structural Rules

Full

  1. Every internal node has exactly two children
  2. All leaves are on the same or adjacent levels
  3. Maximum nodes for height h = 2^(h+1) – 1

Degenerate

  1. Each parent has only one child (left or right)
  2. Effectively a linked list → Θ(n) height
  3. Worst-case BST shape when data is sorted

Complete

  1. All levels fully filled except possibly the last
  2. Last-level nodes are packed from the left
  3. Array-based heap relies on this structure

How to Identify a Type

  1. Count children for every node
  2. If any node has exactly one child → not full
  3. If height = n – 1 → degenerate / skewed
  4. If level-order scan finds a gap before last node → not complete

Height & Complexity

Tree TypeHeight
Full (balanced)Θ(log n)
CompleteΘ(log n)
Degenerate / SkewedΘ(n)
Advertisement

Test Your Knowledge before moving forward!

Binary Tree Types Quiz

How it works:

  • +1 point for each correct answer
  • 0 points for wrong answers
  • -0.5 point penalty for viewing explanations
  • Earn stars based on your final score (max 5 stars)

Binary Tree Types Implementation

class TreeTypes {
  static Full(capacity = 7) {
    const tree = Array.from({ length: capacity }, (_, i) => i + 1);
    console.log("Full Binary Tree (level):", tree.join(" "));
  }

  static Degenerate(count = 4) {
    const tree = Array.from({ length: count }, (_, i) => i + 1);
    console.log("Degenerate/Skewed (in-order):", tree.join(" -> "));
  }

  static Complete(count = 10) {
    const tree = Array.from({ length: count }, (_, i) => i + 1);
    console.log("Complete Binary Tree (level):", tree.join(" "));
  }
}

TreeTypes.Full(7);
TreeTypes.Degenerate(4);
TreeTypes.Complete(10);

Explore Other Tree Topics