It dont look like a tree its more like a triangle and if the values are stored in the matrix can be simply done using a Dynamic Programming bottom up approach
On Tue, Jul 26, 2011 at 2:27 PM, Charlotte Swazki <[email protected]>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 [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. > > -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- 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.
