What is the algorithm of checking if a Binary tree is a complete binary tree? (Using Prolog).
For example:
?- complete(nil).
true.
?- complete(tree(1,nil,nil)).
true.
?- complete(tree(1,tree(2,nil,nil),nil)).
false.
?- complete(tree(1,tree(2,nil,nil),tree(3,nil,nil))).
true.