Skip to content

Some popular complexities

Course: Arrays - chapter 5

Constant time complexity. Example: a + b, a % b, swap(a, b)

Logarithmic complexity. Example: Binary search

Example: Finding divisors of a number

Linear time complexity. Example: Linear search, finding maximum element

Example: Sorting, Seive of Eratosthenes

Quadratic complexity. Example: Insertion sort

Cubic complexity. Example: Floyd Warshall algorithm

Exponential complexity. Example: bitmasking