make the algo 'dynamic programming'/online
Merge pull request #1 from realtiger/online

make the algo 'dynamic programming'/online