pathcopying
Pathcopying is a technique used in the implementation of persistent, immutable data structures to update a value without duplicating the entire structure. When a change is made, new nodes are created only along the path from the root to the modified location, while the remaining subtrees are shared between the old and new versions. This preserves immutability while enabling efficient updates.
In a tree or nested map, updating a key requires copying the nodes on the path from
Complexity-wise, pathcopying typically costs time proportional to the length of the path being copied (often the
Applications of pathcopying are common in functional programming and libraries that provide persistent data structures, such