Re: [algogeeks] sum of subsequence

2010-07-05 Thread Anand
Here is one more approach: http://codepad.org/h0Ycg99P On Sun, Jul 4, 2010 at 7:56 PM, Ashish Goel ashg...@gmail.com wrote: knapsack problem alternate :sort the array keep two pointers one from start one from end move inwards till the sum is k (move start pointer if the sum k , move right

Re: [algogeeks] sum of subsequence

2010-07-05 Thread Ashish Goel
please share the algo in words also, it takes a bit to understand the code otherwise Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Mon, Jul 5, 2010 at 11:45 AM, Anand anandut2...@gmail.com wrote: Here is one more approach:

Re: [algogeeks] sum of subsequence

2010-07-05 Thread jalaj jaiswal
@ashish goel that will give two numbers which sum upto k there may also be 3 or u numbers ...as i said a subsequence On Mon, Jul 5, 2010 at 11:45 AM, Anand anandut2...@gmail.com wrote: Here is one more approach: http://codepad.org/h0Ycg99P On Sun, Jul 4, 2010 at 7:56 PM, Ashish Goel

[algogeeks] sum of subsequence

2010-07-04 Thread jalaj jaiswal
find the subsequence in an array which sum to k -- With Regards, Jalaj Jaiswal +919026283397 B.TECH IT IIIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To

[algogeeks] sum of subsequence.

2009-10-09 Thread ankur aggarwal
2. Given an array all of whose elements are positive numbers, find the maximum sum of a subsequence with the constraint that no 2 numbers in the sequence should be adjacent in the array. i) 3 2 7 10 should return 13 (sum of 3 and 10) ii) 3 2 5 10 7 should return 15 (sum of 3, 5 and 7)