O'Reilly logo

Programming Groovy 2 by Venkat Subramaniam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Improving Performance Using Memoization

I once attended a bird show where a performer challenged a teenager to compete against a parrot in arithmetic. To the chagrin of the young fellow and the amusement of the viewers, the parrot swiftly replied to “what’s 200 times 50?" After the parrot aced the next few questions, the performer revealed the secret—the parrot simply repeated memorized answers to scripted questions. In this section we’ll use a similar technique, but rather than calling it memorization, we’ll term it memoization, continuing the tradition in our field of giving odd names to concepts.

In the previous section you learned a technique to make recursive calls memory-efficient. Recursion in essence is a way to solve a problem using ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required