ptrie
Ptrie, short for persistent trie, is a functional data structure that implements an associative array using a trie (prefix tree) in a purely immutable way. The structure is designed so that updates such as insertion, deletion or modification produce a new version of the map while sharing unchanged sub‑tries with the previous version. This property allows efficient persistence: several versions of the map can coexist with minimal memory overhead, usually proportional to the number of changes rather than the size of the entire structure.
A typical ptrie is implemented as a tree of nodes, each node holding up to a fixed
Ptries are used in functional programming languages such as Clojure, Scala, and in libraries like C++'s boost::ptrie,
The concept of the persistent trie dates back to the 1980s in functional data structure research, with