Saturday, June 18, 2016

Notes on Dynamic Programming

https://www.youtube.com/watch?v=sF7hzgUW5uY


turning point for me to understand staircase solution:

s(n)=s(n-1)+s(n-2). I was thinking why is not it s(n)=max(s(n-1),s(n-2))+1 since they take one more step to make s(n)?

I start to understand it when I finally realize the expression of "or": in order to go to last staircase n, the number of ways is s(n-1) with 1 step OR from s(n-2) with 1 big step. number of steps you take is not part of number of ways to go to nth staircase. OR here tell me it is the sum of the two situations:taking on step from n-1 or taking one step from n-2.

This series of videos are good.
https://www.youtube.com/watch?v=u6Y055g4mOE#t=545.373486

No comments: