📊

Big O Algorithm Complexity Comparator

Compare operation counts for common Big O complexity classes at a given input size n.

The size of the input to the algorithm (number of elements).

Results

O(1) operations1
O(log n) operations9.97
O(n) operations1,000
O(n log n) operations9,966
O(n�) operations1,000,000

📖What is it?

For informational/educational purposes only. Big O notation describes how an algorithm's runtime or space requirements grow as the input size increases. Comparing complexity classes helps you choose the most efficient algorithm for your use case.

🎯How to use

Enter an input size n (e.g., 1,000 items in an array). The calculator shows the approximate number of operations each major complexity class would require at that size, making the differences stark and intuitive.

💡Example scenario

For n = 1,000: O(1) = 1 op, O(log n) = ~10 ops, O(n) = 1,000 ops, O(n log n) = 9,966 ops, O(n�) = 1,000,000 ops. Switching from O(n�) to O(n log n) is a 100� improvement at this scale.

🏆Pro tip

Big O ignores constant factors and lower-order terms. For small n, an O(n�) algorithm with small constants may outperform an O(n log n) one. Always benchmark with realistic data. Space complexity matters as much as time complexity in memory-constrained environments.