Binary Search
The foundation of database indices. Watch how aggressively O(log n) searches eliminate half the problem at every step, requiring sorted inputs first.
Builders shipping scripts and apps
Upgrade your toolkit. We'll dive into dictionaries, stacks, queues, and classic searches. These are the daily drivers you'll use in every backend you ever build.
The foundation of database indices. Watch how aggressively O(log n) searches eliminate half the problem at every step, requiring sorted inputs first.
Scan for the absolute minimum, then anchor it at the front. It guarantees exactly n-1 swaps—useful in systems where writing data is much costlier than reading it.
Slide elements left until they hit order. It's actually incredibly fast for naturally 'nearly sorted' data, which happens in the real world constantly.
Converging indices. See how marching a left and right pointer can elegantly solve array problems in O(n) time, bypassing the classic O(n²) double loop.
The O(1) dictionary trick. This is the bedrock for counting frequencies—an essential pattern when you're querying fast instead of looping slow.
Last In, First Out (LIFO). Push, pop, and peek your way to understanding how undo-trees, browser histories, and function call stacks actually operate.
First In, First Out (FIFO). Tasks in, tasks out. This animates the core mechanism behind task workers, event loops, and rate limiters.
Are these strings just scrambled? Watch how mapping character frequencies in a dictionary solves this gracefully without the overhead of sorting strings.
Gliding a fixed frame over an array. See how it subtracts the outgoing element and adds the incoming one, saving you from disastrous O(n*k) recalculations.
Zipper two sorted arrays together. This is the cornerstone sub-routine that powers the beast that is Merge Sort.