assuming its a binary tree
Node* mirror(Node* root){
if(root==NULL)
return;
Node* mirrorLeft = mirror(root->left)'
Node* mirrorRight = mirror(root->right);
root->left = mirrorRight;
root->right=mirrorLeft;
return root;
}
On Mar 11, 4:50 am, AKS <[email protected]> wrote:
> can u elaborate a bit ??
> with sm example if possible
>
> On Mar 11, 4:52 am, priyank desai <[email protected]> wrote:
>
>
>
>
>
>
>
> > Do a post order traversal of the tree and swap its child instead of
> > printing the node values.
>
> > On Mar 10, 8:19 am, Subhransupanigrahi <[email protected]>
> > wrote:
>
> > > Hey guys,
> > > you guys have came across many time with mirror a tree. if anyone has
> > > effective ways interms of memory & efficiency way to implement mirror of
> > > a tree.
>
> > > Sent from my iPhone
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.