Logarithms

What logarithms are, key properties, common vs natural log, and why O(log n) appears everywhere in CS. The inverse of exponentiation.

49 lessons
127 min
Codeforces: 800-1200LeetCode: 1200-1500

Lessons

1. Intro

The Goal

2m

2. What Are Logarithms? (The inverse)

Undoing exponentiation

3m

3. Logarithm Notation (Reading the symbols)

Base and argument explained

2m

4. Quiz: Basic Logarithms (Knowledge check)

Test your understanding

1m1 problems

5. Binary Logarithm (Base 2)

Most common in CS

3m

6. Common Logarithm (Base 10)

Scientific notation base

2m

7. Natural Logarithm (Base e)

Calculus and growth rates

3m

8. Logarithm of 1 (Special case)

Any base equals zero

2m

9. Logarithm of the Base (Another special case)

Always equals one

2m

10. Product Rule (Multiplication becomes addition)

First logarithm property

3m

11. Quotient Rule (Division becomes subtraction)

Second logarithm property

3m

12. Power Rule (Exponent comes out front)

Third logarithm property

3m

13. Quiz: Logarithm Properties (Knowledge check)

Test your understanding

1m1 problems

14. Change of Base Formula (Converting bases)

Switch between any bases

3m

15. Why Bases Don't Matter in Big-O (Constant factor)

All logarithms are equivalent

3m

16. The Halving Pattern (Where log n comes from)

Divide and conquer

3m

17. Binary Search Example (Classic log n algorithm)

Halving the search space

3m

18. Tree Height Example (Another log n pattern)

Balanced binary trees

3m

19. Quiz: Logarithmic Growth (Knowledge check)

Test your understanding

1m1 problems

20. Problem - Power Function (Entry problem)

LeetCode 50

2m1 problems

21. Power - The Insight (Squaring trick)

Halve the exponent

3m

22. Power - Implementation (The code)

Recursive solution

4m1 problems

23. Power - Complexity Analysis (Why it's logarithmic)

Time and space breakdown

3m

24. Lessons from Power (Summary)

What you learned

2m

25. Problem - Search Insert Position (Second problem)

LeetCode 35

2m1 problems

26. Search Insert - The Insight (Binary search variant)

Find or insert position

3m

27. Search Insert - Implementation (The code)

Binary search solution

4m1 problems

28. Search Insert - Walkthrough (Tracing execution)

Step-by-step example

3m

29. Lessons from Search Insert (Summary)

What you learned

2m

30. Problem - Perfect Squares (Third problem)

LeetCode 279

2m1 problems

31. Perfect Squares - The Insight (DP with square roots)

Building from smaller values

3m

32. Perfect Squares - Implementation (The code)

DP solution

4m1 problems

33. Perfect Squares - Logarithm Connection (Square roots and logs)

Why logs appear

3m

34. Lessons from Perfect Squares (Summary)

What you learned

2m

35. Logarithms in Merge Sort (Divide and conquer)

Tree height analysis

3m

36. Logarithms in Quicksort (Average case)

Balanced partitions

3m

37. Logarithms in Heaps (Insert and extract)

Heap operations

3m

38. Quiz: Logarithms in Algorithms (Knowledge check)

Test your understanding

1m1 problems

39. Problem - Find Kth Smallest (Fourth problem)

LeetCode 378

2m1 problems

40. Kth Smallest - The Insight (Binary search on values)

Count elements below threshold

3m

41. Kth Smallest - Implementation (The code)

Binary search solution

4m1 problems

42. Lessons from Kth Smallest (Summary)

What you learned

2m

43. Logarithms and Bit Manipulation (Powers of 2)

Binary representation

3m

44. Logarithms and Number of Digits (Base 10)

Counting digits

2m

45. Quiz: Logarithms and Numbers (Knowledge check)

Test your understanding

1m1 problems

46. Logarithmic Growth vs Linear Growth (Scaling comparison)

Why log n is fast

3m

47. Logarithmic Space Complexity (Recursion depth)

Call stack usage

3m

48. Common Logarithm Mistakes (Pitfalls to avoid)

What to watch out for

3m

49. Section Recap

What we learned

3m

Ready to start learning?

Access all 49 lessons with interactive content and progress tracking.