{
  "schema_version": "1.0",
  "codex": "thecodex.expert/coding",
  "type": "algorithm",
  "slug": "algorithms/complexity",
  "name": "Big O Notation",
  "section": "Algorithms",
  "canonical_definition": "Big O notation describes the asymptotic upper bound on the growth rate of an algorithm's time or space requirements as a function of input size n, abstracting away constant factors and lower-order terms to characterise how the algorithm scales.",
  "complexity": {
    "O(1)": "constant",
    "O(log n)": "logarithmic",
    "O(n)": "linear",
    "O(n log n)": "linearithmic",
    "O(n^2)": "quadratic",
    "O(2^n)": "exponential"
  },
  "confidence": "high",
  "last_verified": "2026-06-01",
  "url": "https://thecodex.expert/coding/algorithms/complexity/",
  "concept_relationship": {
    "requires_first": [
      "concepts/loops",
      "concepts/recursion"
    ],
    "enables": [
      "algorithms/sorting",
      "data-structures"
    ],
    "commonly_confused_with": [
      "O(1) means constant not fast",
      "O(n log n) is not O(n^2)",
      "average vs. worst case are different"
    ]
  },
  "sources": [
    {
      "num": 1,
      "citation": "CLRS 4th ed. Ch.3",
      "tier": 1
    },
    {
      "num": 2,
      "citation": "Knuth 1976 ACM SIGACT News 8(2)",
      "tier": 1
    },
    {
      "num": 3,
      "citation": "Bachmann 1894 Die analytische Zahlentheorie",
      "tier": 1
    },
    {
      "num": 4,
      "citation": "Sedgewick & Wayne Algorithms 4th ed.",
      "tier": 1
    }
  ]
}