📅 Date: Jan 15, 2026
🔥 Topic: Time Complexity (Big O Notation)


⏳ Why does it matter?

I used to think "fast code" meant typing fast. I was wrong.
In programming, efficiency isn't measured in seconds (because that depends on the computer hardware). It is measured by how the number of operations grows as the Input (N) grows.

[Image of Big O complexity chart]

📈 Big O Notation (The Yardstick)

We use Big O to describe the "Worst Case Scenario".

  • O(1) - Constant Time: Best! accessing an array index arr[5]. Takes same time regardless of array size.
  • O(n) - Linear Time: Fair. A simple Loop. If input increases 10x, time increases 10x.
  • O(n²) - Quadratic Time: Slow. Nested Loops (Loop inside a Loop). If input increases 10x, time increases 100x!

⚠️ The Warning

Starting tomorrow, I will learn Sorting. Most basic sorting algorithms are O(n²). They work fine for 10 items but will freeze the computer for 1,000,000 items.


💭 Thoughts

Before writing code, I now ask: "Is this loop necessary?" Optimization starts in the brain, not the keyboard.