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 2k nodes at every depth k < n and between 2n and 2n+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 1-based indexing. If child index is greater than the number of nodes, the child does not exist.
Thanks to Adrienne G. Bloss (firstname.lastname@example.org) 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".
If you have suggestions, corrections, or comments, please get in touch with Paul Black.
Entry modified 16 November 2016.
HTML page formatted Fri Feb 23 10:06:07 2018.
Cite this as:
Paul E. Black, "complete binary tree", in Dictionary of Algorithms and Data Structures [online], Vreda Pieterse and Paul E. Black, eds. 16 November 2016. (accessed TODAY) Available from: https://www.nist.gov/dads/HTML/completeBinaryTree.html