TLDR:

Get the Time Complexity by suppressing constant factors (too system dependent) and lower order terms and constants (irrelevant for larger inputs / as approaches ). The big five are Big O, Little o, Big Omega, Little omega, Big Theta.

There’s 5 different bounds we can measure against to get an idea for how much time an algorithm will take:

What is ?

The point at which the asymptotic bounding of a function becomes true.

Also:

You can also say is . That is refer to specific worst/best case scenario of a different algorithm.

1. Big O Notation (Upper Bound):

  • Notation:
  • Definition: if there exist positive constants and ​ such that for all ​.
  • Textbook Defintion:
  • Intuition: Big O notation gives an upper bound on the growth rate of an algorithm, describing the worst-case scenario.
  • Simply: grows no faster than
  • Example:

2. Big Omega Notation (Lower Bound):

  • Notation:
  • Definition: if there exist positive constants and ​ such that for all .
  • Textbook Definition:
  • Intuition: Big Omega notation gives a lower bound on the growth rate of an algorithm, describing the best-case scenario.
  • Simply: grows no slower than
  • Example:

3. Big Theta Notation (Tight Bound):

  • Notation:
  • Definition: if and only if and .
  • Textbook Definition:
  • Intuition: Big Theta notation gives both an upper and lower bound on the growth rate of an algorithm, describing the average-case scenario.
  • Example:
  • Fun Fact: It’s commutable

4. Little o Notation (Upper Bound, but not Tight):

  • Notation:
  • Definition: if for every constant , there exists a constant ​ such that for all .
  • Textbook Definition:
  • Intuition: Little o notation gives an upper bound like Big O, but it is not tight. It indicates that grows strictly slower than .
  • Example: (I.E. grows faster than )

5. Little omega Notation (Lower Bound, but not Tight):

  • Notation:
  • Definition: if for every constant , there exists a constant ​ such that for all .
  • Textbook Definition:
  • Intuition: Little omega notation gives a lower bound like Big Omega, but it is not tight. It indicates that grows strictly faster than .
  • Example: (I.E. grows slower than )

Difference between Big and little?

The Big , , all give you exact time limit of a function. They’re hard bounded (E.G. ). They’re the “at most / at least”.

Whereas the Little , are the equivalent of saying “Strictly Less/Greater Than”. (E.G. )

Weird Quirk:

Say an algorithm’s Big O is (the amount of time it will take is ). It would also be true to say that it has a time complexity of and . It’s less informative and we tend to only be interested in the most tightest bound for an algorithm we can get.

Properties:

Transitivity:

If upper bound of f(n) is g(n) and upper bound of g(n) is h(n), then upper limit of f(n) is h(n). It’s the same (but opposite) for lower bound.

Summation of Bounds:

If you sum 2 functions with the same bound, you get back the same bound.

Examples: