Finding the maximum weight subsequence of an array of positive integers?

Posted by BeeBand on Stack Overflow See other posts from Stack Overflow or by BeeBand
Published on 2010-05-23T11:33:08Z Indexed on 2010/05/23 11:40 UTC
Read the original article Hit count: 270

I'm tring to find the maximum weight subsequence of an array of positive integers - the catch is that no adjacent members are allowed in the final subsequence.

The exact same question was asked here, and a recursive solution was given by MarkusQ.

He provides an explanation, but can anyone help me understand how he has expanded the function? How does this solution take into consideration non-adjacent members?

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about language-agnostic