Skip to content

Associative Arrays

Published On:
Jan 29, 2019
Last Updated:
Jul 1, 2026

Overview

An associative array can also be known as a map, symbol table or dictionary.

Hash Tables

A hash table is a type of associative array where a hash is calculated from a given key, and the key’s value is stored at the memory address pointed to by the key’s hash.

Complexity

The table below shows the time complexity of common hash table operations. The worst case occurs when all keys hash to the same bucket, degrading lookups to a linear scan.

OperationAverage CaseWorst Case
LookupO(1)\mathcal{O}(1)O(n)\mathcal{O}(n)
InsertionO(1)\mathcal{O}(1)O(n)\mathcal{O}(n)
DeletionO(1)\mathcal{O}(1)O(n)\mathcal{O}(n)