Types of Binary Trees

Three Types

Full Binary Tree
Degenerate / Skewed
Complete Binary Tree

Visual Comparison

Full Binary Tree

A Full Binary Tree is a type of binary tree in which every node has either 0 or 2 children. It is perfectly structured, and all internal nodes have exactly two children while leaves are aligned at the same or adjacent levels, making it balanced for operations and ideal for understanding fundamental tree structures.

Degenerate (Skewed) Tree

A Degenerate or Skewed Tree is a tree where each parent has only one child, making it essentially a linked list. It has the worst-case height of Θ(n), which can occur in unbalanced binary search trees when inserting sorted data without balancing, leading to inefficient operations.

Complete Binary Tree

A Complete Binary Tree is a binary tree in which all levels are fully filled except possibly the last, which is filled from left to right. It is the structure used by heaps, ensuring operations can be performed efficiently with predictable height and balanced shape.

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)

Binary tree types

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 implementation