Greedy Algorithm Vs Dynamic Programming And Optimal Control