A New Dynamic Programming Algorithm for the Shortest Path Problem