Help in Recursion!!!

Revision en1, by restart., 2015-10-11 10:51:36

suppose i have an array of n=5 elements say A={50,10,20,30,40}; when I pick i element from the array I can not pick i+1 element from the array. So how much value can I pick which will not exceed 100. So in this case I can pick maximum {50,40} which is less than 100. I tried to solve this using recursion, but i failed to do so because i can't establish any relation. How can I do so? Please help... I am new to recursion related topic.. TIA...

Tags recursion, dp, c++

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English restart. 2015-10-11 10:51:36 466 Initial revision (published)