foundation

Computer Science and Algorithms

Complexity analysis, data structures, graph traversal, and recurring interview patterns.

Interview preparation works best when every concept ties to three things: what the interviewer expects, how the idea behaves in code, and which trade-offs matter in production. Use the checklist at the end of each topic to turn passive reading into active recall.

Start by naming input size, operations that dominate runtime, and memory growth. For data-structure questions, explain both average behavior and the pathological case. Strong answers compare alternatives: a linear array scan may be fine for tiny data, while a hash map often buys simpler O(1) lookups at the cost of extra memory.

On interviews: state assumptions before optimizing, walk through one concrete example, and mention when you would choose a simpler brute-force approach in production.

Common pitfalls: jumping to the optimal structure before clarifying constraints; forgetting space complexity; skipping edge cases like empty input, duplicates, or negative numbers.

Checklist:

  • Define n before using Big O.
  • Mention time and memory.
  • State assumptions about ordering, duplicates, and mutation.
  • Test edge cases before optimizing.