dsa basics revision

📅 21 Jul 2025

View on Github ↗

date: 2025-07-21 topics: [dsa, algorithms, logic, revision] day: 5

📘 Day 5 – Core DSA Pattern Revision

✅ What I Worked On

  • Revisited 8 essential DSA problems, focusing on logic behind each
  • Wrote down edge cases and dry-ran each problem
  • Practiced by hand + IDE to reinforce patterns

📚 What I Learned

ProblemPattern / Concept
Max in ArrayLinear scan (compare & track)
Even/OddUse % 2 to check parity
Reverse ArrayTwo-pointer swap method
Prime CheckLoop till √n for efficiency
FibonacciSimple loop, track a and b
2nd MaxTrack max and second max separately
PalindromeTwo pointers inward comparison
Bubble SortRepeated swaps until sorted

Each of these teaches classic logic + patterns like:

  • Loop control
  • Pointer movement
  • Condition-based decisions
  • Optimization by bounds

❌ Blockers

  • Initially missed edge cases like:
    • Reversing odd-length arrays
    • Negative numbers for max
    • Prime of 1 and 0

🧠 Reflection

Solving DSA problems is great — but today I realized understanding the "why" and the "how" behind each approach is 10x more powerful. These core problems form the foundation for every complex question that comes later.

🔗 References / Code