Do inorder traversal and maintain a bit vector equal to height of tree also
keep an current shortest path bit vector
in last print path using shortest path bit vector.

keep updating shortest path bit vector when path shorter than current
shortest path is found.


On Tue, Jul 26, 2011 at 9:57 AM, Charlotte Swazki
<charlotteswa...@yahoo.fr>wrote:

> Hi,
>
> I want to implement an algorithm to determine the shortest path from the
> top to down.
>
> like:
>
>
> int py_path_shoretest(int size, int **map);  // return the shortest path
> value. size is the height.
>
>
> int main(void)
> {
>  int map =  {
>                         {1},
>                        {2, 3},
>                       {8, 0, 2},
>                      {1, 3, 9, 3}
>                   };
> printf("%d\n", py_path_shoretest(4, map));  // will return 6.
>
>
>
> }
>
> Do I have to travel all posibilities, to calculate everything?do you have
> any idea ?
>
> I have all in a
> struct node
> {
> int val;
> struct *node r;
> struct *node l;
> };
>
> Regards,
> Charlotte.
>
> --
> 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.
>
>


-- 
*With Regards :*

Ravinder Kumar
B.Tech Final Year
Computer Science and Engineering
MNNIT Allahabad

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