Skip to main content

Menu

LEVEL 0
0/5 XP
HomeAboutTopicsPricingMy VaultStats

Categories

πŸ€– Artificial Intelligence
☁️ Cloud and Infrastructure
πŸ’Ύ Data and Databases
πŸ’Ό Professional Skills
🎯 Programming and Development
πŸ”’ Security and Networking
πŸ“š Specialized Topics
HomeAboutTopicsPricingMy VaultStats
LEVEL 0
0/5 XP
GitHub
Β© 2026 CheatGridβ„’. All rights reserved.
Privacy PolicyTerms of UseAboutContact

Big O Notation Cheat Sheet

Big O Notation Cheat Sheet

Back to Mathematics and Algorithms
Updated 2026-05-25
Next Topic: Bit Manipulation and Bitwise Operations Cheat Sheet

Big O notation is a mathematical framework for describing the asymptotic behavior of algorithms as input size grows toward infinity. Born from computational complexity theory, it abstracts away hardware specifics and constant factors to reveal the fundamental scalability of codeβ€”whether an algorithm remains practical at scale or collapses under growing data. While Big O represents the upper bound (worst-case), companion notations like Big Omega and Big Theta capture lower bounds and tight bounds respectively. The key insight: an O(n) algorithm doubles runtime when input doubles, but an O(n^2) algorithm quadruples itβ€”this multiplicative difference dominates performance at scale, making complexity analysis the single most powerful lens for predicting real-world algorithmic behavior before a single line executes.

What This Cheat Sheet Covers

This topic spans 18 focused tables and 123 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.

Table 1: Common Time ComplexitiesTable 2: Space Complexity FundamentalsTable 3: Asymptotic Notation FamilyTable 4: Case Analysis TypesTable 5: Simplification RulesTable 6: Multiple Input VariablesTable 7: Data Structure OperationsTable 8: Sorting Algorithm ComplexitiesTable 9: Recurrence RelationsTable 10: Master Theorem CasesTable 11: Recursive Algorithm AnalysisTable 12: Growth Rate HierarchyTable 13: Common PitfallsTable 14: Complexity ClassesTable 15: Analysis TechniquesTable 16: Graph Algorithm ComplexitiesTable 17: String Matching Algorithm ComplexitiesTable 18: Advanced Data Structure Complexities

Table 1: Common Time Complexities

The most important complexity classes appear here ranked from fastest to slowest. Understanding where your algorithm falls on this scale β€” and the enormous gulf between adjacent classes at large input sizes β€” is the foundation of algorithmic reasoning.

ComplexityExampleDescription
O(1)
arr[5]
β€’ Constant time β€” execution time independent of input size
β€’ direct access operations, hash table lookups (average), stack push/pop
O(log n)
while (n > 1):
n = n // 2
β€’ Logarithmic time β€” halves the problem space each step
β€’ binary search, balanced tree operations, divide-and-conquer
O(√n)
for i in range(int(n**0.5)):
check_divisor(i, n)
β€’ Square root time β€” iterates up to square root
β€’ primality testing via trial division, some number theory algorithms
O(n)
for i in range(n):
print(arr[i])
β€’ Linear time β€” single pass through data
β€’ iterating arrays, linked list traversal, linear search in unsorted data
O(n log n)
merge_sort(arr)
β€’ Linearithmic time β€” optimal comparison-based sorting
β€’ merge sort, quicksort (average), heap sort
O(n log log n)
Sieve of Eratosthenes
β€’ Slightly worse than linear
β€’ prime sieve algorithms that eliminate multiples logarithmically

More in Mathematics and Algorithms

  • Arithmetic Cheat Sheet
  • Bit Manipulation and Bitwise Operations Cheat Sheet
  • Abstract Algebra Essentials Cheat Sheet
  • Convex Optimization Cheat Sheet
  • Hash Tables and Hash Maps Cheat Sheet
  • Number Theory Cheat Sheet
View all 57 topics in Mathematics and Algorithms