Author | Message |
---|---|
rabbott
Posts: 1649
|
Posted 16:03 Nov 06, 2016 |
While thinking about the remaining projects, I got caught up in Project 9. I couldn't resist writing a solution. Since the problem is constrained to switching back and forth between two roads, it's easy to solve without using a shortest path algorithm. No search is needed. It's a straight-forward propagation from the starting point to the ending point. The key to the solution is finding the right data structure. You can use my code, but I deliberately did not include many comments. You will have to work through it yourself. You should begin by reading the problem as described in Learn You a Haskell and look at the code presented there. (The data structure I use is not presented in the book, but I think it's a better solution.) I am willing to answer specific questions about the code. Last edited by rabbott at
18:09 Nov 06, 2016.
|