|
Re: Techniques For Overcoming Stack Overflow In DP
Agh! I got it! How could I be so silly.
Of course I can BFS and DP at the same time. To solve the subproblems in the correct order, simply traverse the completed BFS queue in reverse!
This is actually essentially the same thing as making my own stack, because just as much memory will be used. The the only difference is the problems get solved in a different order. So I could do it either way.
Finally got it after 72 hours of thought. And after all that, I think I will actually go with the custom stack.
Thanks guys.
|