[algogeeks] problem tree minimum sum in binary

2011-07-26 Thread Charlotte Swazki
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},    

Re: [algogeeks] problem tree minimum sum in binary

2011-07-26 Thread sunny agrawal
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 charlotteswa...@yahoo.frwrote: Hi, I want to implement an algorithm to determine

Re: [algogeeks] problem tree minimum sum in binary

2011-07-26 Thread Ravinder Kumar
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,

Re: [algogeeks] problem tree minimum sum in binary

2011-07-26 Thread SkRiPt KiDdIe
for(i=sz-2;i=0;i--) for(j=0;j=i;j++) ar[i][j]+=min(ar[i+1][j],ar[i+1][j+1]); coutar[0][0]; is this fine.? -- 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