Every time you push a value onto a stack, insert a node into a list, or rotate a tree, the old version vanishes. That is the default bargain in most programming: one structure, one present moment, no memory of the past.
Persistent data structures break that bargain. After every update you get a new version — but the previous version is still there, fully accessible, unchanged. You can keep a hundred versions of a list in memory and query any of them in the time it would take to query a single ordinary list.
The idea was formalized in a landmark 1986 paper by Driscoll, Sarnak, Sleator, and Tarjan — "Making Data Structures Persistent" — which gave us two elegant techniques: path copying (copy only the nodes on the path from root to the change) and fat nodes (store a timestamped history of values inside each node). Both achieve full persistence with only a logarithmic overhead over the ephemeral version.
Persistence is not just a theoretical curiosity. It is the backbone of functional programming, the engine behind version-control systems, and a key tool in computational geometry algorithms that need to query the past.
Comments
Loading comments...