Write a function that will interchange all left and right subtrees in a binary tree.


Difficulty level
This exercise is mostly suitable for students
void interchange(Btree *B)
{
    Btree aux;
    if(*B)
    {
        aux=(*B)->left;
        (*B)->left  = (*B)->right;
        (*B)->right = aux;
        interchange(&((*B)->left));
        interchange(&((*B)->right));
    }
}

Back to the list of exercises
Looking for a more challenging exercise, try this one !!
Dijkstra Algorithm