← Back to Algorithms

Big O Notation

Understanding how the runtime of an algorithm grows as the input size increases.

Explanation

Big O notation is used to describe the performance of an algorithm. It classifies algorithms based on how their resource requirements grow as the input size increases. There are two primary metrics:

  • Time Complexity: How the runtime of an algorithm grows. This is the most common use of Big O.
  • Space Complexity: How the memory usage of an algorithm grows.

Big O doesn't measure exact speed or memory, but rather the rate of growth. This is crucial for comparing how algorithms will perform with very large inputs.

Visualization

Select a complexity

Click on the buttons above to toggle the visibility of different Big O complexities and learn more about them.