Big-O Notation Reference

Visualize and compare algorithm time complexities from O(1) to O(n!) with interactive charts, a comprehensive algorithm database, and complexity ratings.

About This Tool

The Big-O Notation Reference is a free browser-based tool for understanding and comparing algorithmic time and space complexities. Whether you are preparing for a coding interview, studying data structures and algorithms, or optimizing production code, this tool helps you visualize how different complexity classes scale as input size grows.

The interactive growth chart draws curves for O(1), O(log n), O(n), O(n log n), O(n²), O(n³), O(2ⁿ), and O(n!) side by side. A slider lets you adjust the input size n from 1 to 100 and watch how the number of operations changes in real time. The chart uses a logarithmic Y-axis automatically when values span many orders of magnitude, making it easy to see the dramatic differences between polynomial and exponential growth.

The complexity table summarizes each class with its name, a performance rating (Excellent to Horrible), representative algorithms, and the exact operation count at the current value of n. The algorithm search tab provides a searchable database of 30+ common algorithms — from binary search and merge sort to Floyd-Warshall and the traveling salesman problem — each annotated with time complexity, space complexity, category, and a concise description.

If you are working on sorting, the Number Base Converter can help you understand binary representations used in radix sort. For performance profiling of your own code, the Timestamp Converter is useful for benchmarking execution times. And the HTTP Status Codes reference pairs well when analyzing API response-time budgets.

All rendering and computation happens entirely in your browser — no data is ever sent to any server. The chart is drawn on an HTML Canvas element with no external charting libraries, keeping the page fast and dependency-free.

How to Use

  1. Open the Growth Chart tab to see all complexity curves plotted together. Drag the Input Size (n) slider to see how the curves diverge as n increases.
  2. Click the colored legend buttons above the chart to toggle individual complexity classes on or off for a cleaner comparison.
  3. Read the operation count cards below the chart — they show the exact number of operations each complexity class would require at the current value of n.
  4. Switch to the Complexity Table tab for a structured overview: notation, name, rating, example algorithms, and operations at n.
  5. Open the Algorithm Search tab and type an algorithm name (e.g. "quicksort") or a category (e.g. "Graph") to instantly find its complexity class.
  6. Use the category dropdown to filter algorithms by type: Sorting, Searching, Data Structures, Graph, Mathematics, Combinatorics, or Dynamic Programming.
  7. Press Ctrl+Shift+C (or Cmd+Shift+C on Mac) to copy a summary of all complexity values at the current n to your clipboard.

Popular Big-O Examples

View all Big-O examples →

FAQ

What is Big-O notation?

Big-O notation describes the upper bound of an algorithm's time or space requirements as a function of input size n. It tells you how an algorithm scales — O(n) means the work grows linearly with n, while O(n²) means it grows with the square of n. It ignores constant factors and lower-order terms to focus on the dominant growth rate.

What is the difference between O(n log n) and O(n²)?

O(n log n) grows much slower than O(n²). For example, at n=1000, O(n log n) ≈ 10,000 operations while O(n²) = 1,000,000 operations. This is why efficient sorting algorithms like merge sort and quicksort (average case) at O(n log n) vastly outperform bubble sort and selection sort at O(n²) for large inputs.

When does Big-O notation not tell the full story?

Big-O ignores constant factors and lower-order terms. An O(n) algorithm with a huge constant can be slower than an O(n log n) algorithm for practical input sizes. It also only describes worst-case (or average-case) behavior — actual performance depends on hardware, cache behavior, and the specific data. Amortized analysis and best-case scenarios provide additional nuance.

What is the difference between time complexity and space complexity?

Time complexity measures how the number of operations grows with input size. Space complexity measures how the memory usage grows. An algorithm can be fast but use a lot of memory (like merge sort: O(n log n) time, O(n) space), or slow but use very little memory (like bubble sort: O(n²) time, O(1) space).

Why is the Y-axis sometimes logarithmic?

When you increase n, exponential and factorial complexities produce astronomically large numbers that would make polynomial curves appear as flat lines near zero. The logarithmic scale compresses the Y-axis so you can still see and compare all curves meaningfully on the same chart.

Is my data safe?

Yes. This tool runs entirely in your browser. The chart is drawn on an HTML Canvas element using vanilla JavaScript — no data is sent to any server, no external APIs are called, and no cookies or tracking are used. You can verify this by checking the Network tab in your browser’s developer tools.

Can I use this tool for interview preparation?

Absolutely. The algorithm search database covers the most commonly asked algorithms in technical interviews. You can quickly look up any algorithm’s time and space complexity, understand its category, and see how it compares to alternatives. The visual chart also helps build intuition for why interviewers prefer O(n log n) solutions over O(n²) ones.

Related Tools