Dynamic programming applications, substructure, and summary