Convert mystery_recursive into a linear-time dynamic programming algorithm mystery_iterative using a loop (rather than memoized recursion) in Python. (This code is not solving any particularly interesting problem; it’s just an example.)
What is your question? Can't you create a dictionary((0,1), (1, x), and calculate the function values for n = 2 to whatever, using the dictionary and the given recursion , updating the dictionary as you go?
I hate signatures!
posted 1 year ago
Thanks for all of the help Marshall Ritchie but, problem solved. Eh.
The fastest and most reliable components of any system are those that are not there. Tiny ad:
Devious Experiments for a Truly Passive Greenhouse!