|
Re: Techniques For Overcoming Stack Overflow In DP
How do I increase stack size?
The problem isn't duplicated states. If I were traversing duplicated states, the depth would be infinite (because the graph is cyclical). And besides, the whole point of DP is it handles these repeated subproblems implicitely.
There are 20,000 distinct states. The problem is as I traverse these distinct states, they are all reachable from each other through cross edges, so a branch of depth 20,000 immediately unfolds when DFS'd. If it were BFS'd, the depth is only about 15. I need a technique to somehow BFS the graph while DPing it through post-traversal.
|