Foundations of programming. Dynamic programming.