
What Is a Stack in Computer Science and How Does Undo Use It?
Follow three edits through an undo history to see what push, pop, and peek do and why a stack reverses the newest edit first.
ICSC Blog
Clear explanations of key ideas in computer science, one concept at a time.

Follow three edits through an undo history to see what push, pop, and peek do and why a stack reverses the newest edit first.

A spam filter can make two very different mistakes. Read the axis labels to see which count means spam got through and which means a real message was flagged.

Six black pixels in a row can share one count. But when black and white alternate, storing a count for every pixel can make the encoded row bigger.

Dijkstra settles a node at distance 2. A route through a node it has not processed yet costs just 1. Three edges show exactly where the algorithm's guarantee breaks.

Follow two library book IDs into the same slot of a tiny hash table. Then look up each ID by checking the entries in that slot.

A variable called best starts with the first number in a list. Prove that it holds the largest number seen so far, and you can explain why the loop returns the right answer.