When I'm working on a algorithm problem, I can usually find a top-down solution that works with recursion.

Then for optimization purpose I try to do a bottom-up approach (dynamic programming) to remove the recursion stack, and I struggle. I have a really hard time initializing the array with the correct value, and then fill it with the answers to the sub problems.

Do you have any recommendations / tips on how to "convert" a top-down solution to a bottom-up algorithm?


marked as duplicate by David Richerby, Evil, D.W. algorithms Jan 26 '18 at 19:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.