mirror of a binary tree

Write a function in c to find the mirror image of a binary tree.Your method should be optimized in memory and time complexity.

Comments

  1. reverse(struct node *root)
    {
    if(root->right==NULL && root->left==NULL)
    return 0;
    else
    {
    swap(root->left,root->right);
    reverse(root->left);
    reverse(root->right);
    }
    }

    ReplyDelete

Post a Comment

Popular posts from this blog