O(1)
This denotes constant time. Running a statement like if (true) {...}
is constant time.
Another example of constant time is looking up a value in an object, array, or a hash table.
O(log n)
This denotes logrithmic time. Divide and conquer or recursive algorithms have a O(log n)
time complexity.
O(n)
This denotes linear time. Whenever we loop through values of an array, that process has a linear time complexity.
O(n log n)
This denotes linearithmic time complexity. An example of this is merge sort, which features recursion with a binary split.
O(n^2)
This denotes quadratic time. Think double nested loops.
O(n^3)
This denotes exponential time. Think triply nested loops.