Dear all,
How good is this function which implements level order traversal of
binary tree ?
level_trav(struct node *sn)
{
struct node *queue[MAX];
int front = rear = -1;
front++;
rear++;
queue[rear] = sn;
while(front <= rear)
{
sn = queue[front++];
if(sn != NULL)
{
printf("%d",sn -> val);
queue[++rear] = sn -> left;
queue[++rear] = sn -> right;
}
}
}