[algogeeks] Re: Subset with largest sum

2006-04-08 Thread BiGYaN
It is simple. Here are the steps, tot = sum of the entire array max = tot start = 0 end = n-1 sub_start = start sub_end = end while ( start < end ) { if ( array[start] < array[end] ) { tot=tot-array[start] start++ } else { tot=tot-array[start] end-- } if ( tot >= max

[algogeeks] Re: Subset with largest sum

2006-04-05 Thread shishir
Yes, am sorry, its infact the continous sub-sequence which I missed in the question. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegr

[algogeeks] Re: Subset with largest sum

2006-04-05 Thread Imran Mohammed Abdul Muqsith
I think it it max sub-sequence problem which is discussed on this link : http://discuss.fogcreek.com/techinterview/default.asp?cmd=show&ixPost=3052     On 4/5/06, Vijendra Singh <[EMAIL PROTECTED]> wrote: I dont get it, if its just the subset, then just get the sum of all positive nos. may be you

[algogeeks] Re: Subset with largest sum

2006-04-05 Thread Vijendra Singh
I dont get it, if its just the subset, then just get the sum of all positive nos. may be you wanted continous nos.another variation of the question can be, find the subset where (sum of subset)/(max element of the set) is maximum. Lets discuss this as well :)Thanks,VijendraOn 4/5/06, shishir <[EMAI