Big O notation

Big O notation describes an asymptotic upper bound on how a function, such as an algorithm’s running time or memory use, grows with input size. It formalizes statements about growth while setting aside constant factors and lower-order terms, allowing broad comparison of algorithmic resource requirements. Big O is a mathematical bound, not by itself a claim about an algorithm’s worst-case behavior or its exact running time.

Last updated
30 October 2026
Confidence
High (99%)
Sources
4
Versions
1
This article was researched and drafted with AI assistance and checked by an automated review pass. It is not guaranteed to be accurate — verify important facts against the references below.

Definition

For functions that are nonnegative for sufficiently large inputs, f(n) is O(g(n)) if there are positive constants c and n₀ such that f(n) ≤ c·g(n) for every n ≥ n₀. In words, after some threshold, g(n) multiplied by a fixed constant bounds f(n) from above. The constants cannot vary with n. For example, 3n² + 4n + 5 is O(n²), because its growth is eventually bounded by a constant multiple of n². It is also O(n³), but O(n²) is a tighter upper bound.

Use in algorithm analysis

Computer scientists use Big O to describe how a resource measure changes as an algorithm’s input grows. The resource may be running time, memory, comparisons, or another operation count; a particular analysis should say which measure and computational model it uses. For example, a procedure that scans all n items in a list performs work proportional to n and is O(n), under a model that counts each inspection as constant work. A binary search on a sorted array repeatedly halves the remaining search range and takes O(log n) comparisons in the worst case.

Growth rates and simplification

Asymptotic analysis focuses on sufficiently large input sizes. When simplifying a polynomial expression such as 5n² + 3n + 8, the n² term eventually dominates the lower-order terms, and the constant multiplier is absorbed into the bound; the expression is therefore O(n²). Common growth classes include O(1), O(log n), O(n), O(n log n), O(n²), and exponential bounds such as O(2ⁿ). These classes help compare how resource use may scale, but actual performance also depends on implementation, hardware, input size, and constant factors.

Bounds are not cases

Big O states an asymptotic upper bound; it does not intrinsically mean worst case. Best-case, average-case, and worst-case analyses describe which inputs of each size are being considered. Each of those measures can be expressed with Big O. A tight upper bound can also be described using Θ notation when matching upper and lower bounds are established; Ω notation expresses an asymptotic lower bound. These notations distinguish the type of mathematical bound from the choice of input case.

Origin and terminology

The capital O is read “big oh” and is commonly associated with the German word Ordnung, meaning order. The notation arose in mathematical analysis before becoming standard in computer science. It should not be confused with the Greek letter omicron, or treated as an equality: f(n) = O(g(n)) conventionally means that f belongs to the class of functions bounded asymptotically by g, not that the two functions are identical.

Key facts

Meaning
An asymptotic upper bound on a function's growth.
Formal condition
f(n) = O(g(n)) when fixed positive constants c and n₀ exist such that f(n) ≤ c·g(n) for all sufficiently large n.
Common uses
Describing algorithmic time, memory, or operation-count growth as a function of input size.
Important distinction
Big O is not synonymous with worst-case analysis; best, average, and worst cases can each have Big O bounds.
Related notations
Ω denotes an asymptotic lower bound, while Θ denotes a matching asymptotic upper and lower bound.

Ask about this article

Answers use only “Big O notation” and its references, with citations.

References

  1. 1.
    big-O notation

    National Institute of Standards and Technology, Dictionary of Algorithms and Data Structures · other · reliability: unverified · retrieved 30 October 2026

    Supports: Defines the formal Big O upper-bound condition, discusses resource measures, and gives examples and terminology.

  2. 2.
    Big O and Asymptotic Analysis — Lecture 7

    Stanford University, Department of Computer Science · other · reliability: unverified · retrieved 30 October 2026

    Supports: Introduces algorithm growth rates, operation counts, common asymptotic classes, and the interpretation and limits of Big O.

  3. 3.
    1.1. Algorithm Analysis

    OpenDSA, Virginia Tech · other · reliability: unverified · retrieved 30 October 2026

    Supports: Defines Big O as an upper bound, distinguishes upper bounds from worst-case analysis, and explains Ω and Θ notation.

  4. 4.
    Dictionary of Algorithms and Data Structures (DADS)

    National Institute of Standards and Technology · other · reliability: unverified · retrieved 30 October 2026

    Supports: Describes the NIST dictionary as an online reference for algorithms, data structures, algorithmic techniques and related definitions, including Big O notation.

References are suggested by the research engine and may be incomplete. Unverified URLs are omitted rather than guessed.

Article history

  1. Version 130 October 2026 · EditorCreated by Zapia