A complete binary tree is defined as a binary tree in which every level, except possibly the deepest, is completely filled. At deepest level, all nodes must be as far left a
There may be one possible algorithm which I feel would solve this problem. Consider the tree:
Level 0: a
Level 1: b c
Level 2: d e f g
We employ breadth first traversal.
For each enqueued element in the queue we have to make three checks in order:
Advantage: entire tree may not be traversed
Overhead: maintaining flag entries