Algorithms Foundations
Start from zero: what algorithms are, how arrays work in memory, and how simple algorithms like linear search actually execute.
Curriculum (7 steps)
What Is an Algorithm?
articlesA precise, step-by-step procedure for solving a problem or completing a task, illustrated with pseudocode and real-world analogies.
Why array indexing is O(1), how the CPU computes element addresses, and what spatial locality means for performance.
Visualize how contiguous array memory enables cache-friendly access while scattered linked list nodes cause pointer-chase cache misses.
Trace a Linear Search
tracesFollow a linear search across 10 array elements, checking each one until the target is found or the array is exhausted.
Trace an Array Insertion
tracesFollow an array insertion from capacity check through resize, element shift, and write, showing why middle insertion is O(n).
Implement Binary Search
practiceImplement binary search that finds a target value in a sorted array in O(log n) time.
The interview answer covering indexing cost, insertion cost, memory layout, and cache effects.