In computer science, a full tree is a tree in which every node has either zero children or the maximum number of children allowed for that tree type. In a full binary tree, that means every node has either two children or no children—there is no node with exactly one child. That is the direct answer, but the term "full tree" is used somewhat differently depending on context, and those differences are the main source of confusion.

The phrase "a full tree computer science what is it" usually comes from someone encountering the term in a data structures course, a textbook, or an interview-prep site. The most common interpretation is the full binary tree, and that is what this article explains in detail. However, several related terms—complete, perfect, and full—are often mixed up, and some sources use "full" in ways that conflict with the strict definition. Understanding both the standard definition and the common variations will let you read any source accurately.

The strict definition: a full binary tree

A binary tree is a tree where each node has at most two children, conventionally called the left child and the right child. A full binary tree (also called a proper binary tree or a strictly binary tree in some texts) satisfies one rule: every node has either 0 or 2 children. Equivalently, no node has exactly one child.

A few immediate consequences follow from this definition:

Every internal (non-leaf) node has exactly two children. Every leaf is at the same "childless" status—leaves have zero children by definition. If a full binary tree has i internal nodes, it has i + 1 leaves, so the total number of nodes is 2i + 1, which is always odd. The tree can be lopsided. Nothing in the definition requires balance or requires all leaves to be at the same depth.

That last point is where many people go wrong. A full binary tree is not necessarily a perfect tree. Consider a root with a left child that itself has two children, and a right child that is a leaf. Every node has 0 or 2 children, so the tree is full—but it is visibly unbalanced, with leaves at different depths.

Here is a small example in text form:

Node A has two children (B, C). Node B has two children (D, E). Nodes C, D, and E have none. No node has exactly one child, so this is a full binary tree. If we deleted E, then B would have only one child (D), and the tree would no longer be full.

Full vs. complete vs. perfect: the distinctions that matter

The three terms are defined precisely, and they are not interchangeable. A compact comparison helps:

Term Rule Relationship to "full"
Full (proper/strict) Every node has 0 or 2 children The term in question
Complete All levels filled except possibly the last, which is filled left to right with no gaps Independent property; a tree can be complete but not full, or full but not complete
Perfect Every internal node has two children and all leaves are at the same depth Every perfect tree is full, but not every full tree is perfect

To see why complete and full are independent, consider two trees.

A complete but not full tree: take a complete binary tree of height 2 with nodes A (root), B and C (level 1), and D (level 2, left child of B). Node B has one child, D. So the tree is complete—the last level is filled left to right—but not full, because B has exactly one child.

A full but not complete tree: the earlier example with root A, children B and C, and B's children D and E. It is full, but level 1 has a gap on the right side's descendants—C is a leaf while B has children—so it is not complete.

And a perfect but not full situation does not exist in binary trees: perfection implies fullness. The reverse fails, as shown. This asymmetry is worth remembering: perfect ⊂ full, but full does not imply perfect, and neither full nor perfect implies complete in general—though a perfect tree is always complete as well, since all levels are filled with no gaps.

Why the definition matters in practice

Full binary trees are not just a vocabulary exercise. They have structural properties that show up in algorithms and proofs.

Leaf-to-internal-node ratio. In a full binary tree with i internal nodes, the number of leaves is i + 1. This follows from a simple edge count: each of the 2i child edges leads to a distinct node, and the total node count is i + (i + 1) = 2i + 1. This identity is used in proofs about tree encodings, Huffman coding, and expression trees.

Huffman coding. Huffman's algorithm builds an optimal prefix code by repeatedly merging the two least frequent nodes. The resulting Huffman tree is a full binary tree: every merge creates an internal node with exactly two children. This is why a Huffman code is a prefix-free code—no codeword is a prefix of another—because every internal node has two branches, one labeled 0 and one labeled 1.

Expression trees. A binary expression tree for a fully parenthesized arithmetic expression is full: every operator node has two operand children, and every operand is a leaf. An expression with a unary operator, such as negation, would break fullness unless it is modeled specially.

Serialization and reconstruction. Some tree encodings rely on fullness. For example, a full binary tree can be reconstructed from a preorder traversal that marks null children, because each node's child structure is determined. The "full" property constrains the shape and can simplify certain recursive algorithms.

Decision trees and game trees. Some theoretical treatments of binary decision trees assume every internal node has two outcomes, making the tree full. Real decision trees often have nodes with a single branch or multiple branches, so the assumption is a modeling choice, not a universal fact.

Where the term "full tree" gets ambiguous

The trouble with "full tree" is that it is not standardized across every subfield. Three usages are common enough that a careful reader should check which one a source intends.

  1. Full binary tree (the standard usage). Every node has 0 or 2 children. This is the definition in most data structures textbooks and the one assumed in coding interviews.

  2. Full m-ary tree. Generalizing to trees where each node has at most m children, a full m-ary tree has every node with either 0 or exactly m children. A full binary tree is the case m = 2. A full ternary tree, for instance, has nodes with 0 or 3 children. Some texts use "full" for m-ary trees in this way and reserve "complete" for the level-filling property.

  3. "Full" as a synonym for "complete" or "perfect" in loose usage. Some informal sources, and some older or translated materials, say "full tree" when they mean every level is filled—what is more precisely called a complete or perfect tree. This usage conflicts with the strict definition and causes real confusion on exams. If a problem says "full tree" and the answer choices assume all leaves at the same depth, the problem is likely using the loose sense; check the surrounding definitions.

There is also a related term, full and complete tree, which some texts use to mean a perfect tree. That phrase is best read as "perfect" unless the source defines it otherwise.

The practical advice is simple: when you see "full tree," look for the definition the source provides. In a binary-tree context with no other qualifier, assume the 0-or-2-children rule. In an m-ary context, assume 0-or-m children. In a context that talks about "filled levels," the author probably means complete or perfect, and you should verify.

How to tell whether a tree is full

Checking fullness is a straightforward recursive procedure. For each node:

1: If the node is a leaf (no children), it satisfies the rule. 2: If the node has two children, recurse into both. 3: If the node has exactly one child, the tree is not full.

In pseudocode:

The check runs in time proportional to the number of nodes, since each node is visited once. A common mistake is to check only the root's children; fullness is a property of every node, so the recursion must reach the leaves.

A second common mistake is to confuse fullness with balance. A full binary tree can be extremely unbalanced. The tree formed by repeatedly attaching a new internal node with two leaf children to one side of the previous structure is full but has depth linear in the number of internal nodes. Fullness constrains the degree of each node, not the shape of the tree.

Edge cases and common exam traps

A few edge cases are worth stating explicitly, because they appear in quizzes and interviews.

The empty tree. Whether the empty tree counts as full depends on convention. Most definitions say yes, vacuously, since there are no nodes violating the rule. Some definitions require at least one node. If a problem's answer choices hinge on this, note the convention. A single node. A tree with one node is full: that node is a leaf with zero children. Two nodes. A root with one child is the smallest non-full binary tree. Any binary tree with exactly two nodes is not full, because the root has exactly one child. Odd node count. A full binary tree always has an odd number of nodes. If a problem states that a binary tree has an even number of nodes, it cannot be full. This is a fast elimination trick on multiple-choice questions. Height and fullness are independent. A full tree can have any height from logarithmic (if balanced) to linear (if degenerate in the full sense, which requires each internal node to have two children).

Related concepts that often appear alongside

Understanding fullness is easier when placed next to its neighbors.

Complete binary tree. All levels except possibly the last are completely filled, and the last level is filled from left to right. Complete trees are the shape used in array-based binary heaps, because the level-order indexing has no gaps. A heap is a complete binary tree with the heap property; it is not necessarily full.

Perfect binary tree. All internal nodes have two children and all leaves are at the same depth. A perfect binary tree of height h has 2^(h+1) − 1 nodes. Perfect trees are both full and complete.

Balanced binary tree. Informally, a tree whose left and right subtrees differ in height by at most a small amount at every node (for example, an AVL tree allows a difference of at most one). Balance is about height, not child count, so a balanced tree may or may not be full, and a full tree may be badly unbalanced.

Degenerate tree. A tree where each internal node has exactly one child, forming a path. A degenerate binary tree is the opposite of full.

These five properties—full, complete, perfect, balanced, degenerate—describe different aspects of shape. A tree can satisfy several at once, and the combinations are what exam questions and algorithm analyses exploit.

Why textbooks disagree, and how to read them

The variation is not a flaw in the sources so much as a consequence of different subfields needing different vocabulary. Discrete mathematics and combinatorics often work with full m-ary trees and phrase results in terms of "full" plus "complete." Data structures courses focus on binary trees and emphasize the 0-or-2 rule. Algorithm analysis sometimes uses "full" loosely in the sense of "every level filled" when discussing balanced search trees, though careful authors avoid this.

When you read a new source, look for the explicit definition near the first use of the term. If there is none, infer from context: mentions of "left and right children" suggest the binary 0-or-2 rule; mentions of "all levels filled" suggest complete or perfect. When writing your own explanations, state the definition you are using—this is the single most effective way to avoid the confusion that surrounds the term.

A quick self-check

To confirm you have the distinction straight, try these three questions:

1: A binary tree has 7 nodes arranged as root, two children, and four grandchildren under one child. Is it full? (No—the other child of the root is a leaf while its sibling has children, but check node degrees: root has 2, the internal child has 2, the other child has 0, and the four grandchildren have 0. Actually every node has 0 or 2 children, so yes, it is full. Fullness counts children, not balance.) 2: A complete binary tree with 6 nodes: is it full? (No—the last internal node on the last level has one child.) 3: Can a full binary tree have an even number of nodes? (No—2i + 1 is always odd.)

The first question is the classic trap: fullness is about each node's child count, not about whether the tree looks symmetric. A lopsided tree can be perfectly full.

Summary

A full tree, in the most common computer-science sense, is a tree in which every node has either no children or the maximum number allowed—for binary trees, zero or two children. This is distinct from a complete tree (levels filled left to right) and a perfect tree (all leaves at the same depth, which implies fullness but is stronger). The term also generalizes to full m-ary trees, and some informal sources use "full" to mean "complete" or "perfect," so always check a source's definition. The key facts to retain are that fullness constrains child count rather than balance, that a full binary tree has an odd number of nodes with one more leaf than internal nodes, and that the property is checked recursively at every node. With those points in hand, the term stops being ambiguous and becomes a precise, useful tool for reasoning about tree structures.