@anika: Here is the iterative code:
void iter_mirror(Node *root)
{
if(root==NULL)
return;
Node *stack[100];
Node *temp,*temp1;
int top=-1;
stack[++top]=root;
while(top!=-1)
{
temp=stack[top];
temp1=temp->left;
temp->left=temp->right;
temp->right=temp1;
top--;
if(temp->left!=NULL)
stack[++top]=temp->left;
if(temp->right!=NULL)
stack[++top]=temp->right;
}
}
--
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.