[Math] Persistent data structure

In computing, a persistent data structure is a data structure that always preserves the previous version of itself when it is modified. Such data structures are effectively immutable, as their operations do not (visibly) update the structure in-place, but instead always yield a new updated structure.

A data structure is partially persistent if all versions can be accessed but only the newest version can be modified. The data structure is fully persistent if every version can be both accessed and modified. If there is also a meld or merge operation that can create a new version from two previous versions, the data structure is called confluently persistent. Structures that are not persistent are called ephemeral.[1]

These types of data structures are particularly common in logical and functional programming, and in a purely functional program all data is immutable, so all data structures are automatically fully persistent.[1] Persistent data structures can also be created using in-place updating of data and these may, in general, use less time or storage space than their purely functional counterparts.

In the partial persistence model, we may query any previous version of the data structure, but we may only update the latest version. This implies a linear ordering among the versions.

In fully persistent model, both updates and queries are allowed on any version of the data structure.

In confluently persistent model, we use combinators to combine input of more than one previous version to output a new single version. Rather than a branching tree, combinations of versions induce a DAG (directed acyclic graph) structure on the version graph.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 9,959评论 0 23
  • 雨落云遮繁星无,风停雾散月照庐。 独孤侧卧难入寝,愁思冠帔映红烛。
    梧桐琴恋墨弦阅读 340评论 0 1
  • 一路走来,我们经历着无数的艰难坎坷,走到了一半,却已精疲力竭,生活就是看你如何跌倒,如何坚强走下去,再一次一次把你...
    路上春暖花开阅读 236评论 0 0
  • 昨天晚上做了个梦,梦到了我之前喜欢了很久很久的一个女孩。梦里的我跟她走在一起很难受,我以为我已经忘了,可是梦真实的...
    Awkward丶祭司阅读 246评论 0 0
  • 01 “放开我!”不远处传来一阵骚动。 两个士兵正押着一个年轻人。他眼睛突出,头发凌乱,非常消瘦,即使奋力挣扎,依...
    保小罗阅读 911评论 16 28