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
//Helper function
int depth (struct tree * n)
{
int ld,rd;
if (n == NULL) return 0;
ld=depth(n->left);
ld=depth(n->right);
if (ld>rd)
return (1+ld);
else
return (1+rd);
}
//Core function
int isComplete (struct tree * n)
{
int ld,rd;
if (n == NULL) return TRUE;
ld=depth(n->left);
rd=depth(n->right);
return(ld==rd && isComplete(n->left) && isComplete(n->right));
}