If you're interested in functional programming, you might also want to checkout my second blog which i'm actively working on!!

Wednesday, April 4, 2012

Dynamic Programming to the rescue

In my previous blog post I crafted a solution together that created a graph of all possible paths starting from the initial node. Next I filtered out the ones not ending at the goal node. For the paths that were left over I finally calculated the total path cost. As the number of lanes increases you will see that the number of possible paths grows exponentially and my previous code will run into timeouts.

So now i present the same solution but drastically improved using dynamic programming.



No comments:

Post a Comment