Dynamic array (list)

A dynamic array is a structure that stores elements contiguously in memory and grows automatically. In Python, list is one. Index access is O(1), appending at the end is amortized O(1), and inserting or deleting in the middle is O(n) because elements must be shifted.

Example

nombres = [4, 8, 15]
nombres.append(16)  # amortized O(1)
nombres.insert(0, 1)  # O(n)

Related concepts

The whole glossary