Show Menu
Cheatography

Big-O Notation Cheat Sheet by

How to Read Big-O Notation

Common Complexity Classes

O(1)
"O of one"
Constant
O(log n)
"O of log n"
Logari­thmic
O(√n)
"O of square root n"
Square Root
O(n)
"O of n"
Linear
O(n log n)
"O of n log n"
Linear­ithmic
O(n²)
"O of n square­d"
Quadratic
O(n³)
"O of n cubed"
Cubic
O(n⁴)
"O of n to the fourth­"
Quartic
O(nᵏ)
"O of n to the k"
Polynomial
O(2ⁿ)
"O of two to the n"
Expone­ntial
O(3ⁿ)
"O of three to the n"
Expone­ntial
O(cⁿ)
"O of c to the n"
Expone­ntial
O(n!)
"O of n factor­ial­"
Factorial

Reading Compound Expres­sions

O(n + m)
"O of n plus m"
O(n² + n)
"O of n squared plus n"
O(n² log n)
"O of n squared log n"
O(n log² n)
"O of n log squared n"
O(n log log n)
"O of n log log n"
O((n + m)²)
"O of quantity n plus m square­d"
O(2ⁿ × n)
"O of two to the n times n"

Simple Rule

* If the exponent is attached to n,
... say: "n square­d," "n cubed,­" or "n to the ..."
* If the exponent is attached to a number,
... say: "two to the n," "­three to the n," etc.
Examples:
* n² → "n square­d"
* n³ → "n cubed"
* 2ⁿ → "two to the n"
* 3ⁿ → "­three to the n"
 

Big-O Notation

Growth Order (Fastest ➡️ Slowest)

O(1)
O(log n)
O(√n)
O(n)
O(n log n)
O(n²)
O(n³)
O(nᵏ)
O(2ⁿ)
O(n!)
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          More Cheat Sheets by CashM

          Firebase-Express Template with User Auth Cheat Sheet
          React & Material UI Project startup Cheat Sheet
          devCodeCamp Docker Container Cmds Cheat Sheet