二叉树的镜像化

2015-02-28  本文已影响12人  lintong
void mirror(struct node* node)
{
  if (node==NULL)
    return; 
  else
  {
    struct node* temp;
     
    /* do the subtrees */
    mirror(node->left);
    mirror(node->right);
 
    /* swap the pointers in this node */
    temp        = node->left;
    node->left  = node->right;
    node->right = temp;
  }
} 
上一篇下一篇

猜你喜欢

热点阅读