Associative array

Computer/Terms 2008. 5. 30. 09:48

An associative array (also associative container, map, mapping, hash, dictionary, finite map, lookup table, and in query-processing an index or index file) is an abstract data type composed of a collection of keys and a collection of values, where each key is associated with one value. The operation of finding the value associated with a key is called a lookup or indexing, and this is the most important operation supported by an associative array. The relationship between a key and its value is sometimes called a mapping or binding. For example, if the value associated with the key "bob" is 7, we say that our array maps "bob" to 7. Associative arrays are very closely related to the mathematical concept of a function with a finite domain. As a consequence, a common and important use of associative arrays is in memoization.

From the perspective of a programmer using an associative array, it can be viewed as a generalization of an array: While a regular array maps Integer and/or Enumerated types to arbitrarily typed objects (integers, strings, pointers, and, in an OO sense, objects), an associative array maps arbitrarily typed objects to arbitrarily typed objects. (Implementations of the two data structures, though, are usually considerably different.)

The operations that are usually defined for an associative array are:
- Add: Bind a new key to a new value
- Reassign: Bind an old key to a new value
- Remove: Unbind a key from a value and remove the key from the key set
- Lookup: Find the value (if any) that is bound to a key

Reference:
http://en.wikipedia.org/wiki/Associative_array

Posted by 알 수 없는 사용자
,