Lookup table

In computer science, a lookup table is a data structure, usually an array or associative array, used to replace a runtime computation (calculation) with a simple array indexing operation. The main purpose is in saving run time since retrieving a value from memory is often faster than undergoing a time consuming computation (see Space-time tradeoff). Lookup tables are also used to validate input values by matching against a list of valid (or invalid) items in an array.