@Aman : check this(same as ankit said) :
http://tech-queries.blogspot.com/2009/05/max-possible-sum-of-non-consecutive.html

On Fri, Jul 29, 2011 at 9:59 AM, ankit sambyal <ankitsamb...@gmail.com>wrote:

> 1. Make an array S equal to the length of the given array where
>             S[0] = a[0] and S[1] = max(a[0],a[1])
>
> 2. for i:2 to n-1
>
>          S[i] = max(S[i-2]+a[i], S[i-1])
>
> 3. return S[n-1]
>
>  --
> 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.
>



-- 
Thank You
Rajeev Kumar

-- 
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.

Reply via email to