Write a function to find the deepest node of the binary tree.


Difficulty level
This exercise is mostly suitable for students
Btree deepest(Btree B)
{
    queue q;
    Btree temp;
    temp=NULL;
    
    if(B)
    {
        q=CreateQueue();
        EnQueue(&q,B);
        while(Front(q,&temp))
        {
            DeQueue(&q);
            if(temp->right)
                EnQueue(&q,temp->right);
            if(temp->left)
                EnQueue(&q,temp->left);
        }
    }
    return temp;
}

Back to the list of exercises
Looking for a more challenging exercise, try this one !!
Target sum in a BST