Problems with dynamic programming
Posted
by
xan
on Stack Overflow
See other posts from Stack Overflow
or by xan
Published on 2012-03-25T17:08:40Z
Indexed on
2012/03/25
17:30 UTC
Read the original article
Hit count: 187
algorithm
I've got difficulties with understanding dynamic programming, so I decided to solve some problems. I know basic dynamic algorithms like longest common subsequence, knapsack problem, but I know them because I read them, but I can't come up with something on my own :-(
For example we have subsequence of natural numbers. Every number we can take with plus or minus. At the end we take absolute value of this sum. For every subsequence find the lowest possible result.
in1: 10 3 5 4; out1: 2
in2: 4 11 5 5 5; out2: 0
in3: 10 50 60 65 90 100; out3: 5
explanation for 3rd: 5 = |10+50+60+65-90-100|
what it worse my friend told me that it is simple knapsack problem, but I can't see any knapsack here. Is dynamic programming something difficult or only I have big problems with it?
© Stack Overflow or respective owner