Why Is It Called Memoization?

174 Views Asked by At

Memoization is a programming technique where the results of expensive function calls are stored and reused, preventing redundant computations and improving performance.

Sample Memoization

import java.util.HashMap;
import java.util.Map;

public class Fibonacci {

    private static Map<Integer, Integer> memory = new HashMap<>();

    public static void main(String[] args) {
        int result = calculateFibonacci(5);
        System.out.println("Fibonacci number at position 5 is: "  + result);
    }

    private static int calculateFibonacci(int n) {
        if (n <= 1) { return n;}
        if (memory.containsKey(n)) { return memory.get(n); }
        
        int fib = calculateFibonacci(n - 1) + calculateFibonacci(n - 2);
        memory.put(n, fib);

        return fib;
    }
}

Clearly defined by the explanation and exemplified by the example, this technique involves creating a cache for results and memorizing values, utilizing memory. In everyday language, this behavior is also referred to as memorization.The omission of the "r" in the term is simply unnecessary and can make the naming definition vague.

I am wondering why this technique is called "memoization" instead of "memorization"?

1

There are 1 best solutions below

0
Federico klez Culloca On

Exactly because it's NOT "memorization" and has a specific meaning beyond simply memorizing something. I.e., you're memorizing something for a specific purpose (a performance benefit, not simply storing information).

According to Wikipedia, on memoization (emphasis mine):

The term "memoization" was coined by Donald Michie in 1968 and is derived from the Latin word "memorandum" ("to be remembered"), usually truncated as "memo" in American English, and thus carries the meaning of "turning [the results of] a function into something to be remembered". While "memoization" might be confused with "memorization" (because they are etymological cognates), "memoization" has a specialized meaning in computing.

While memorization is generically

the process of committing something to memory