# Complete Binary Tree Definition confusion

Hello everyone.
I have a doubt about the definition of Complete Binary Tree .
I know by definition from wiki " a complete binary tree every level, except possibly the last , is completely filled, and all nodes in the last level are as far left as possible.

So,
the above tree is a complete binary tree?
I have doubt because solution on geeks for geeks won’t accept the above tree and I don’t see it conflicting with definition.

The definition you’ve given is a little vague, but I’m guessing this doesn’t qualify because the last-level element “5” is not as far to the left as it could be (it could be re-parented so that it is 2’s right-child).

1 Like

Yes you are right, this doesn’t qualify for complete binary tree.
This is just a binary tree not complete binary tree.
A binary tree can have 0 or 1 or 2 child nodes at each level.
A complete binary tree must have 0 or 2 child nodes at each level.
Correct me if I am wrong.

5 should be attached to 2 that makes sense to make it far left as possible. Ok that clear things up thanks.
also the definition is from Wikipedia if it’s vague. What woud be exact definition?

Sorry, but a complete binary tree can have a node with one child.
The tree which has 0 or 2 nodes is a full binary tree not complete.

Hello there, This tree is not a complete binary tree. The condition which is violated here is the order in which the nodes must be filled. The nodes must be filled from left to right one by one (somewhat like the aufbau’s principle in chemistry). So try to fill the right node of 4 and then move forward. Greetings!!!

Can you provide any proof for the statement that nodes must be filled in order in order to qualify binary tree as complete binary tree?