(data structure)

**Definition:**
A *binary tree* in which every *level* (depth), except possibly the deepest, is completely filled. At depth n, the *height* of the tree, all *nodes* must be as far left as possible.

**Generalization** (I am a kind of ...)

*complete tree*, *binary tree*.

**Specialization** (... is a kind of me.)

*binary heap*, *perfect binary tree*.

**See also**
*full binary tree*, *extendible hashing*, *heap*.

*Note:
A complete binary tree has 2 ^{k} nodes at every depth k < n and between 2^{n} and 2^{n+1}-1 nodes altogether. It can be efficiently implemented as an array, where a node at index i has children at indexes 2i and 2i+1 and a parent at index i/2, with one-based indexing. If child index is greater than the number of nodes, the child does not exist. *

After LK.

Thanks to Adrienne G. Bloss (bloss@roanoke.edu) September 2003.

* This kind of tree is called "complete" by authors that mention it (Budd page 332, Ege, Carrano & Prichard page 427, Goodrich & Tamassia page 302, [HS83, page 226], [Knuth97], [Stand98, page 249]). Some authors call perfect binary trees "complete".*

Author: PEB

Go to the Dictionary of Algorithms and Data Structures home page.

If you have suggestions, corrections, or comments, please get in touch with Paul Black.

Entry modified 27 August 2014.

HTML page formatted Mon Feb 2 13:10:39 2015.

Cite this as:

Paul E. Black, "complete binary tree", in
*Dictionary of Algorithms and Data Structures* [online], Vreda Pieterse and Paul E. Black, eds. 27 August 2014. (accessed TODAY)
Available from: http://www.nist.gov/dads/HTML/completeBinaryTree.html