Extensions of Dynamic Programming for Combinatorial Optimization and Data Mining