Skip to content

Glossary: Data Structures and Algorithms in JavaScript

Big-O notation

Also written: Big-O, O(1), O(n), O(n²), O(log n), O(n log n), O(V + E), constant time, linear time, quadratic time, logarithmic time

A way to describe how the number of steps grows as the input size n grows, ignoring constants and smaller terms. O(1) stays flat, O(n) grows in step with n, O(n²) usually comes from a loop inside a loop, and O(V + E) is the cost of BFS and DFS, where V is the number of vertices and E the number of edges.

Where the book teaches it

Related terms

Worst caseSpaceAverage caseLogarithm