⏱
Big O Complexity Quiz
Read each code snippet and identify its time and space complexity. Select your answers and check to see if you're right. Work through all 30 examples to master complexity analysis.
Progress
1 / 30
Score
0 / 0 checked
#1
Linear Search
Loopsdef find_element(arr, target):
for x in arr:
if x == target:
return True
return False
Big O Quick Reference
| Complexity | Name | n=10 | Example |
|---|---|---|---|
| O(1) | Constant | 1 | Hash map lookup, array index |
| O(log n) | Logarithmic | 3 | Binary search, heap ops |
| O(n) | Linear | 10 | Single loop, linear scan |
| O(n log n) | Linearithmic | 33 | Merge sort, heap sort |
| O(n²) | Quadratic | 100 | Nested loops, bubble sort |
| O(n³) | Cubic | 1,000 | Triple nested loops, naive matrix mult |
| O(2ⁿ) | Exponential | 1,024 | Naive fibonacci, power set |
| O(n!) | Factorial | 3,628,800 | All permutations, TSP brute force |