Re: [algogeeks] rectangle of max sum MS Q

2012-01-20 Thread atul anand
@amrit : inner most loop is running kadane algo :- i am not writing whole algo , just giving necessary information ... you can google kadane algo... /** for(k=0;kcol;k++) { sum_till_here+=mat[i][k] - *(mat[j][k])*; // here i am excluding row = j and finding the

Re: [algogeeks] rectangle of max sum MS Q

2012-01-20 Thread atul anand
@amit : After understanding given example for 1D array ...you can consider each column as 1D array ...then i guess you will get it. On Fri, Jan 20, 2012 at 2:32 PM, atul anand atul.87fri...@gmail.com wrote: @amrit : inner most loop is running kadane algo :- i am not writing whole algo , just

[algogeeks] Re: Shared nodes

2012-01-20 Thread sravanreddy001
since there are N leaves... N/2 leaves(i will call nodes) will share only root. why? (they are on the other side of the root) N/4 leaves share 2 nodes N/8 leaves share 3 nodes... so on... = there are N paths, as there are N leaves, (or N-1 to be precise.. excluding leaf v )== so.. its N/2 * 1

[algogeeks] Re: vertical level sum in Binary tree

2012-01-20 Thread sravanreddy001
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

Re: [algogeeks] Explanation

2012-01-20 Thread sravanreddy001
@phoenix: NULL character is \0 -- ascii value 0x00 Number 0 is char '0' -- ascii value is 0x30 or 48 so, 48 when encountered.. it prints.. 0, when \0 is found... it stops... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this

Re: [algogeeks] Re: vertical level sum in Binary tree

2012-01-20 Thread UTKARSH SRIVASTAV
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,