@ UTKARSH : how will you calculate number of vertical lines before passing it to vsum().
i guess n should be max(no. of nodes to the extreme left from the root , no. of nodes to the extreme right from root) On Fri, Jan 20, 2012 at 10:35 PM, UTKARSH SRIVASTAV <usrivastav...@gmail.com > wrote: > void vsum(struct node *p ,int i) > { > if(p) > { > sum[i] = sum[i] + p->data; > vsum(p->left,i-1); > vsum(p->right,i+1); > } > } > > construct an array of int sum[n] where n will be maximum no. of vertical > lines and call vsum with vsum(root,n/2) > > > On Fri, Jan 20, 2012 at 9:06 PM, sravanreddy001 > <sravanreddy...@gmail.com>wrote: > >> what does it mean.. we cannot use an array? (a static array?) >> >> a vector is an array..but a dynamic one... what other DS can be used? a >> linked list allowed? >> >> (each of the two algorithms can be mate to work with linked list too... >> (except that it takes more time.. ) >> >> -- >> 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/-/GN5SzfqtYlgJ. >> >> 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. >> > > > > -- > *UTKARSH SRIVASTAV > CSE-3 > B-Tech 3rd Year > @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. > -- 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.