Differential dynamic programming and Newton's method for discrete optimal control problems