Q3 -
possible approaches -

if the tree is simply - i think we need to store two traversals inorder and
preorder in file.
otherwise in case of BST preorder traversal is sufficient to recreate the
tree.

for general tree - do a breadth first traversal and for each node next to it
put its parent value (assuming repeated values not allowed in tree). while
recreating the tree read two values at a time from file and attach the node
to its parent.

On Sun, Sep 4, 2011 at 2:54 PM, sukran dhawan <sukrandha...@gmail.com>wrote:

>
>
> ---------- Forwarded message ----------
> From: sukran dhawan <sukrandha...@gmail.com>
> Date: Sun, Sep 4, 2011 at 2:53 PM
> Subject: Re: [algogeeks] Tejas networks
> To: algogeeks@googlegroups.com
>
>
> reverse a linked list
>
> void reverse(struct node ** head)
> {
>     struct node * last,*temp;
>
> last = *head;
> while(last->next != null)
> last = last->next;
>
> while(*head != last)
> {
> temp = *head;
> *head = (*head)->next;
> temp->next = last->next;
> last->next = temp
> }
> }
>
> On Sun, Sep 4, 2011 at 2:46 PM, Anup Ghatage <ghat...@gmail.com> wrote:
>
>> Could you please give an example for question 3?
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@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.
>>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@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.
>



-- 
........................
*MOHIT VERMA*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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.

Reply via email to