Begin Algo
Data structures · 5 lessons

Array & HashingIndexed and keyed access

Arrays trade contiguous memory for O(1) access by position; hash tables trade a hash function for O(1) access by key. These two are the foundation of almost every program, and usually the first tool to reach for in an interview.

Why learn Array & Hashing

Where it shows up
Caches and sessions

A user ID mapping to a login state, a URL mapping to cached content — both are hash tables. Redis is, at heart, one very large hash table.

→ Lesson: Hash Table
"How many times does this letter appear?"

Counting character frequencies, checking whether two words are anagrams, finding duplicates — a hash table turns every one of those lookups into O(1).

→ Lesson: Hash Set / Map Patterns
Range totals in a report

Asked for revenue from day 1000 to day 5000? Compute prefix sums once and every later question is a single subtraction.

→ Lesson: Prefix Sum
Images and game boards

A picture is a 2D array. Rotating it 90 degrees, walking it in a spiral, finding connected cells on a board — all 2D array work.

→ Lesson: Matrix

Lessons

5 lessons