70 likes | 269 Views
Persistent Data Structures (Version Control ). Partial persistence. Full persistence. Confluently persistence. Purely functional. Ephemeral. version list. version DAG. version tree. v 0. v 0. v 0. v 0. car cdr. update. never modify only create new pairs only DAGs. v 1.
E N D
Persistent Data Structures (Version Control) Partialpersistence Full persistence Confluently persistence Purelyfunctional Ephemeral version list version DAG version tree v0 v0 v0 v0 carcdr update nevermodify onlycreate new pairs onlyDAGs v1 v1 v1 v2 v1 v2 v2 v2 v3 v6 v3 queryonly v3 v3 v4 v5 v5 update/merge/queryall versions updates at leaves any version canbecopiedquery all versions v4 v4 v5 v5 Retroactive v0 v1 v2 v3 v4 v6 v6 update & query all versions updates in the pastpropragate update& query query
Planar Point Location T1 T2 T3 T4 T5 T6 T7 Partialpersistentsearchtrees update O(n∙log n) preprocessing, O(log n) query
Pathcopying (trees) root pointer c c a f f d e g
Partialpersistence [0,8[ [8,13[ [13,[ • Version ID = time = 0,1,2,... • Fast node (any data structure) • record all updates in node (version,value) pairs • fieldupdates O(1) • fieldqueries predecessorwrt version id (searchtree/vEB) • Node copying (O(1) degree data structures) • Persistent node = collectionof nodes, each valid for an interval of versions, with extraupdates, = max indegree • pointers must have subinterval of the node pointing to; otherwisecopy and insert pointers (cacadingcopying)NB: Needs to keeptrack of back-pointers
Fullpersistence 1 4 3 2 increasing version 1 4 7 5 3 6 2 preordertraversal Version list (ordermaintenance data structure) 7 5 6 Version tree (numbers = version ids) [5,3[ [4,3[ [4,5[ [0,5[ [5,[ [0,[ split version 5 • Fat node • Updates (1,x) (6,y) (7,z) to a field • Queries = binarysearchamong versions • Update (7,z): Insert 7 as leftmostchild of 4; insert pairs for 7 and 5=succ(7) • Node splitting (≥2 ekstra fields)
Persistencetechniques [N. Sarnak, R.E. Tarjan, Planar point location using persistent search trees, Communications of the ACM, 29(7), 669-679, 1986] Partialpersistence, trees, O(1) access, amortized O(1) update [J.R. Driscoll, N. Sarnak, D.D. Sleator, R.E. Tarjan, Making Data Structures Persistent, Journal of Computer and System Sciences, 38(1), 86-124, 1989] Partial & fullpersistence, O(1) degree data structures, O(1) access, amortized O(1) update [P.F. Dietz, R. Raman, Persistence, Amortization and Randomization. Proceedings 2nd Annual ACM-SIAM Symposium on Discrete Algorithms, 78-88, 1991][G.S. Brodal, Partially Persistent Data Structures of Bounded Degree with Constant Update Time,Nordic Journal of Computing, volume 3(3), pages 238-255, 1996] Partialpersistence, O(1) degree data structures, O(1) access & updatesupdate [P.F. Dietz, Fully Persistent Arrays. Proceedings 1st Workshop on Algorithms and Data Structures, LNCS 382, 67-74, 1989] Fullpersistence, RAM structures, O(loglog n) access, O(loglog n) amortizedexpectedupdates
Comparison of persistencetechniques • Copy data structure for each version • noquery overhead, slowupdates& wastes a lot of space • Recordupdates & keepcurrent version • fast updates & queries to current version, spaceefficient, slowqueries in the past • Pathcopying • applies to trees, noquery overhead, space overhead = depth of update • Fat node • partialpersistence: O(1) updates and space optimal, loglog n query overhead • fullpersistence: O(loglog n) expectedamortizedupdatesand space optimal, loglog n queryoverhead • Node copying/splitting • fast updates &queries (amortizedupdates for fullpersistence) • onlyworks for pointer-basedstructureswith O(1) degree