# Space Complexity

*noun*

say it: **“SPAYS kum-PLEK-suh-tee”** **/speɪs kəmˈplɛksəti/**

How the extra memory code needs grows as its data grows.

## What is **space complexity**?

**Space complexity** is how the *extra* memory a piece of code needs grows as its data grows. A search that keeps one counter needs O(1) extra memory; running totals that keep one number per song need O(n). Spending memory can save time, which is one of the most common trade-offs in programming.

## In a sentence

- “Keeping a running total for every song has a **space complexity** of O(n).”

Level: Journeyman · [More Software Development terms at this level](https://www.ask-codey.com/glossary?category=software-development&level=3)

Updated: November 9, 2026

Source: https://www.ask-codey.com/glossary/space-complexity
