[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,890評論 0 23
  • 雨落云遮繁星無,風停霧散月照廬。 獨孤側臥難入寢,愁思冠帔映紅燭。
    梧桐琴戀墨弦閱讀 340評論 0 1
  • 一路走來,我們經歷著無數的艱難坎坷,走到了一半,卻已精疲力竭,生活就是看你如何跌倒,如何堅強走下去,再一次一次把你...
    路上春暖花開閱讀 236評論 0 0
  • 昨天晚上做了個夢,夢到了我之前喜歡了很久很久的一個女孩。夢里的我跟她走在一起很難受,我以為我已經忘了,可是夢真實的...
    Awkward丶祭司閱讀 246評論 0 0
  • 01 “放開我!”不遠處傳來一陣騷動。 兩個士兵正押著一個年輕人。他眼睛突出,頭發凌亂,非常消瘦,即使奮力掙扎,依...
    保小羅閱讀 901評論 16 28