# Full vs. Complete Binary Tree: What’s the Difference?

A full tree is a tree where every node has either zero or two children. This means that all of the nodes in the tree are either leaf nodes or internal nodes.

Written by Alex Zelinsky
Published on Sep. 05, 2023
Image: Shutterstock / Built In

In computer science, a tree is a data structure that consists of nodes connected by edges. A tree can have many different shapes and sizes, but two common types of trees are full trees and complete trees. A full tree is one in which every node has either zero or two children. A complete tree is one where all levels are fully filled except possibly the last level.

## Full vs. Complete Binary Tree Explained

• Full Binary Tree: This is a tree in which every node has either zero children or two children. It’s most common in binary decision-making algorithms, as every node contains two paths, either a “yes” or a “no.”
• Complete Binary Tree: This is a tree in which all levels are fully filled, except for possibly the last level, which is filled from left to right. It’s useful for improving storage optimization because it ensures that each level is filled entirely before populating the next.

Understanding the difference between these two types of trees can be useful in a variety of contexts, including algorithms and data storage.

## What Is a Full Binary Tree?

As we shared earlier, every node in a full tree has either zero or two children.  This means that all of the nodes in the tree are either leaf nodes (nodes without children) or internal nodes (nodes with children).

Full trees have a distinct advantage when binary decisions are integral to the application. In decision-making algorithms, a full tree ensures that every node presents only two paths, reflecting a “yes” or “no” choice. This binary branching facilitates straightforward and predictable processing, streamlining traversal through the tree.

Here is an example of a full tree:

``````        1
/ \
2   3
/ \
4   5
/ \
6   7
``````

In this tree, every node has either zero or two children, so it’s a full tree.

More on Data ScienceHow Database B-Tree Indexing Works

## What Is a Complete Binary Tree?

A complete tree is a tree where all of the levels are fully filled, except for possibly the last level. The last level of a complete tree should be filled from left to right.

Complete trees shine when space optimization and consistent node placement are important. These trees ensure that each level is filled entirely before populating the next, boosting storage optimization and allowing for swift operations like node addition or removal.

Here is an example of a complete tree:

``````        1
/ \
2   3
/ \ / \
4   56  7
/
8
``````

More on Data ScienceHow to Implement Binary Search in Python

## Differences Between Full and Complete Binary Trees

One key difference between full trees and complete trees is the number of children that each node can have. In a full tree, every node must have either zero or two children. In a complete tree, every non-leaf node must have exactly two children, and the nodes in the last level must be left-filled and can have between zero and two children.

Another important difference between full and complete trees is the way that the nodes are organized. In a full tree, the nodes can be organized in any way, as long as every node has either zero or two children. In a complete tree, the nodes must be organized in a specific way, with all levels fully filled except for possibly the last level.

Full trees and complete trees are both common types of trees in computer science. The key differences between these two types of trees are the number of children that each node can have, and the way that the nodes are organized.