recursive problem

Jason Orendorff jason at jorendorff.com
Wed Feb 27 17:10:12 EST 2002


> I've been looking at the "mystery M function" question [...]
> What I'm doing here is storing in a Dictionary the result of m
> where I get one, so I can use it later. As I said it still blows.
> Any clues for how to improve my algorithm appriciated.

The technique you're using is called memoization, and it's a
smart thing to try.

My advice:  don't count on Python to get the answer.  Try it
for yourself with pencil and paper.  Remember to memoize the
results yourself.  But don't start with m(4, 4, 4).  Start
smaller.

## Jason Orendorff    http://www.jorendorff.com/




More information about the Python-list mailing list