Definition of the complete binary tree

advertisements

I came upon two resources and they appear to say the basic definition in two ways.

Source 1 (and one of my professor) says:

All leaves are at the same level and all non-leaf nodes have two child nodes.

Source 2 (and 95% of internet) says:

A full binary tree (sometimes referred to as a proper or plane binary tree) is a tree in which every node in the tree has either 0 or 2 children.

Now following Source 2,

becomes a binary tree but not according to Source 1 as the leaves are not in the same level.

So typically they consider trees like,

as Full Binary Tree.

I may sound stupid but I'm confused what to believe. Any help is appreciated. Thanks in advance.


There are three main concepts: (1) Full binary tree (2) Complete binary tree and (3) Perfect binary tree. As you said, full binary tree is a tree in which all nodes have either degree 2 or 0. However, a complete binary tree is one in which all levels except possible the last level are filled. Furthermore, a perfect binary tree is a full binary tree such that all levels are at the same depth. For more see the wikipedia page

My intuition for the term complete here is that given a fixed number of nodes, a complete binary tree is made by filling each level completely except possibly the last one, since the number of nodes may not be of the form 2^n - 1.