Big O Notation

Measuring algorithm speed. Why constants vanish. The complexity classes.

49 lessons
149 min
Codeforces: 800-1300LeetCode: 1200-1500

Lessons

1. Intro

(Why speed matters)

2m

2. The Speed Problem

(Why execution time varies)

3m

3. Input Size

(The key variable)

4m

4. What Big O Means

(Worst-case upper bound)

4m

5. Why We Ignore Constants

(Growth patterns matter)

3m

6. Drop Lower-Order Terms

(Highest power dominates)

3m

7. O(1) - Constant Time

(No loops needed)

3m

8. Constant Time Example

(Array access)

3m

9. O(n) - Linear Time

(One pass through data)

3m

10. Linear Time Example

(Finding maximum)

3m

11. Problem - Find Maximum

(Analyzing linear scan)

2m1 problems

12. Find Maximum - Insight

(Single pass suffices)

3m

13. Find Maximum - Algorithm

(Loop and compare)

2m

14. Find Maximum - Implementation

(Implementation structure)

3m1 problems

15. O(n²) - Quadratic Time

(Nested loops)

3m

16. Quadratic Example

(Checking all pairs)

3m

17. Quiz: Complexity Classes

(Knowledge check)

2m1 problems

18. O(log n) - Logarithmic Time

(Halving search space)

3m

19. Logarithmic Example

(Binary search)

4m

20. O(n log n) - Linearithmic Time

(Efficient sorting)

3m

21. Linearithmic Example

(Merge sort)

3m

22. O(2^n) - Exponential Time

(Trying all subsets)

3m

23. Exponential Example

(Naive Fibonacci)

4m

24. O(n!) - Factorial Time

(All permutations)

3m

25. Comparing Growth Rates

(Ranked by speed)

3m

26. How to Analyze Code

(Counting loops)

3m

27. Sequential Loops

(Addition rule)

3m

28. Nested Loops

(Multiplication rule)

3m

29. Problem - Two Sum

(Comparing O(n²) vs O(n))

2m1 problems

30. Two Sum - Insight

(Hash map lookups)

3m

31. Two Sum - Algorithm

(Single pass with map)

3m

32. Two Sum - Implementation

(Hash map approach)

4m1 problems

33. Space Complexity

(Memory usage)

4m

34. Recursive Space

(Call stack depth)

3m

35. Quiz: Space vs Time

(Knowledge check)

2m1 problems

36. Amortized Analysis

(Average over sequence)

4m

37. Best vs Worst Case

(When Big O varies)

4m

38. Problem - Binary Search

(Analyzing logarithmic search)

2m1 problems

39. Binary Search - Insight

(Divide and conquer)

3m

40. Binary Search - Algorithm

(Shrinking window)

3m

41. Binary Search - Implementation

(Iterative implementation)

4m1 problems

42. Practical Analysis Tips

(Quick heuristics)

4m

43. When Constants Matter

(Real-world tradeoffs)

4m

44. Quiz: Analysis Practice

(Knowledge check)

2m1 problems

45. Problem - Contains Duplicate

Compare time complexities

2m1 problems

46. Contains Duplicate - Insight

Three approaches

3m

47. Contains Duplicate - Algorithm

Hash set approach

3m

48. Contains Duplicate - Implementation

The pseudocode

4m1 problems

49. Section Recap

What we learned

2m

Ready to start learning?

Access all 49 lessons with interactive content and progress tracking.