Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the different techniques for memoization in Java? [closed]

Tags:

I know of this one http://onjava.com/pub/a/onjava/2003/08/20/memoization.html but is there anything else?

like image 415
ranv01 Avatar asked Sep 02 '10 04:09

ranv01


People also ask

What is memoization technique?

In programming, memoization is an optimization technique that makes applications more efficient and hence faster. It does this by storing computation results in cache, and retrieving that same information from the cache the next time it's needed instead of computing it again.

What is memoization in Java?

Memoization is a technique whereby we trade memory for execution speed. Suppose you have a function which. Is costly to execute. Always returns the same output for the same input. May be called many times with the same input.

What is memoization in dynamic programming give example?

Memoization is a common strategy for dynamic programming problems, which are problems where the solution is composed of solutions to the same problem with smaller inputs (as with the Fibonacci problem, above).


1 Answers

To memoize functions without parameters, use Guava's Suppliers.memoize(Supplier). For functions with parameters, use CacheBuilder.build(CacheLoader) with parameter value objects as keys.

like image 93
thSoft Avatar answered Sep 19 '22 20:09

thSoft