Adding gen_dp: C++ implementation for generic dynamic programming algorithm.