Associative Array

An associative array (also associative container, map, mapping, dictionary, finite map, and in query-processing an index or index file) is an abstract data type composed of a collection of unique keys and a collection of values, where each key is associated with one value (or set of values). 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.

Associative arrays have a variety of names. In SmallTalk, Objective C, .NET, Python and R E A Lbasic they are called dictionaries; in Perl and Ruby they are called hashes; in C++ and Java they are called maps (see map (C++) and Map) and in Common Lisp and Windows Power Shell they are called Hash Table-s (since both typically use this implementation). In PHP and JavaScript all arrays can be associative, except that the keys are limited to integers and strings. In Visual Fox Pro they are called Collections. In the scripting language Lua, associative arrays, called tables, are used as the primitive building block for all data structures, even arrays. Likewise, in JavaScript, all objects are associative arrays. In MUMPS, the associative arrays are typically stored as B Tree-s.

Edited: |

blog comments powered by Disqus