Re: [algogeeks] Mirroring Binary Tree Pattern Problem

2010-06-15 Thread divya jain
This C code will create a new mirror copy tree.
mynode *copy(mynode *root)
{
mynode *temp;
if(root==NULL)return(NULL);
temp = (mynode *) malloc(sizeof(mynode));
temp-value = root-value;
temp-left = copy(root-right);
temp-right = copy(root-left);
return(temp);
}

On 13 June 2010 17:07, BALARUKESH SIVARAMAN sbalarukesh1...@gmail.comwrote:

 try this one..
 make a level order traversal and store the elements in array... on the
 other system reconstruct it using right element for the left and left
 element for the right...

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Mirroring Binary Tree Pattern Problem

2010-06-13 Thread jaladhi dave
what is a virtualization concept ???


I am a newbie regarding the Algo Analysis. I was asked this question
 recently in an interview. Please let me know if anyone of you know how to
 solve this.

 *Question:*
 Assume You have a binary Tree (not sorted and not BST) with a specific
 pattern on a Desktop1. How can this same binary Tree has be to mirrored to
 another desktop?

 *My Approach:*
 1. Traverse the binary tree and store the elements in an array. Transfer
 the same to another process present on another desktop through socket
 communication. But in this case how do i construct the same binary tree at
 the other end? Do i read in one of the in-order/post-order/pre-order and do
 it the same way at the other end?
 2. Does this involve Virtualization concept?

 Regards,
 Vikas J

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Mirroring Binary Tree Pattern Problem

2010-06-13 Thread BALARUKESH SIVARAMAN
try this one..
make a level order traversal and store the elements in array... on the other
system reconstruct it using right element for the left and left element for
the right...

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Mirroring Binary Tree Pattern Problem

2010-06-12 Thread harit agarwal
just send the inorder and preorder traversal of binary tree to other process
and recontruct it.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.