Skip to content

Glossary: Data Structures and Algorithms in Go

Big-O shapes (O(1), O(log n), O(n), O(n log n), O(n²))

Also written: O(1), constant time, O(log n), logarithmic time, log n, O(n), linear time, O(n log n), O(n²), quadratic time

The common growth rates. O(1) is constant (same steps however big the data); O(log n) halves the work each step (a million items need about 20); O(n) grows in step with the data; O(n log n) is the cost of a good sort; O(n²) is usually a loop inside a loop.

Where the book teaches it

Related terms

Big-O notationBinary searchMerge sortInsertion sort