← Design DS · guided lesson

Design Data Structures

1 / 19 · story

the story

Design from the API (abstract data types)

Every tool here exists because something was too slow or broke without it. Here is what.

1974 · Barbara Liskov (MIT) & Stephen Zilles (IBM)

In 1974 Barbara Liskov and Stephen Zilles published "Programming with Abstract Data Types" at an ACM SIGPLAN symposium. Their idea: describe a data type by the operations its users may call, and keep its representation hidden inside. Liskov's 2008 Turing Award citation honours her contributions to programming language and system design, "especially related to data abstraction, fault tolerance, and distributed computing". Every Java interface you use — List, Map, Deque — is this idea: one API, several representations behind it, each with its own costs.

the problem it solved

Code that reaches into a structure's fields everywhere can't change the structure without breaking. Fixing the operations first lets the inside change freely.

why it matters: without it

Without fixing the API and the per-method costs first, you polish one method and discover at the end that another one is O(n) — the most common way design rounds go wrong.

sources: Liskov & Zilles — Programming with Abstract Data Types (ACM SIGPLAN Notices 9(4), 1974) ↗ · ACM — Barbara Liskov, 2008 A.M. Turing Award ↗

also in this chapter: Array + index map (swap-with-last delete) · Group by count (a bucket per frequency) · Versioned values (floor lookup by time) · Tree of names (paths as a trie) · Counting map (store counts, not copies)