data structures - Please explain this algorithm from Code Jam 2009 -
There is a problem with this. I know that the contest analysis has been posted. But I do not know how to implement BFS when a node can be viewed more than once, I can only use DFS. (Because the reference is in recursive DFS). How to use BFS?
You must explicitly save the context.
For each number cell, place a table of all the formulations that can be produced by the path of length N at that cell, and for each total, the best path that creates it Does.
For N = 1, this data is easily produced (a trivial pathway for each cell) and given to tables for a given EN, you can expand each path By doing the tables for next big N can produce.
Comments
Post a Comment