algo will be something like this:-

i=0;
arr[i]=root;
enqueue(root);

 while queue is not empty
       temp=dequeue();
     i =search for element temp in array temp and return it index
     if(temp->left!=NULL)
     {
          arr[2*i+1]=temp->left;
          enqueue(temp->left);
     }
     if(temp->right!=NULL)
     {

          arr[2*i+2]=temp->right;
          enqueue(temp->right);
    }


}
On Tue, Feb 7, 2012 at 2:18 PM, WgpShashank <[email protected]>wrote:

> @DT Use BFS (Queue) , try it.
>
>
>
>
> --
> *Thanks
> Shashank Mani Narayan
> Computer Science & Engineering
> Birla Institute of Technology,Mesra
> ** Founder Cracking The Code Lab  "http://shashank7s.blogspot.com/"*
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/NHU-lOy0_e8J.
>
> 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.
>

-- 
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.

Reply via email to