[Durable] persistent data structure learning notes and data structure learning notes

Source: Internet
Author: User

[Durable] persistent data structure learning notes and data structure learning notes

I finally want to learn how to be persistent.

------------ The line cut is my> ω <-----------------------
The persistence of data structures means to save all the historical states of a data structure, so as to quickly find the results of a previous operation. Of course, this will inevitably bring about a lot of time and space consumption. Therefore, superior durability will make full use of the similar parts in the historical state of the data structure to reduce the time and space complexity.

Obviously, there is a very bare and persistent posture: embedding a data structure (such as those in the Balance Tree or STL) into each node in the data structure ), then the historical state is maintained with the time keyword (it will obviously add one more log in the time complexity ).
Just look at the persistent line tree and Balance Tree.
Let's learn a little bit about the posture (o) o ☆

Persistence of line tree

Apparently, I can't give him a Balance Tree segment to throw it in...
First, there is nothing to say about the query. It is the same as the query posture of the common line segment tree (that is, the query has a different version). The important thing is to modify it.
For simple single-point modification, you only need to create a new node before modifying each node so that the node can record the status of the current node, then, you can modify the new node (linear • linear regression • linear). For a line segment tree, modifying the number of nodes to be accessed by a point is nothing more Log (n) So each modification will only create Log (n) New nodes.
Next, the interval is modified + marked.
When marking the decentralization, create a new node for the two child nodes and then make a single point of modification. The parent node does not need to be changed (because the decentralization mark does not need to be changed to the parent node ).
How should we establish the tag?
It's easy. If the current node is completely overwritten, just create a node and mark it. If the current node is not completely overwritten, mark the newly created node that is overwritten in its subnode.
The implementation of the Line Segment tree is simple and the code is very short.

Persistence balancing tree

I don't want to learn TreapQAQ
Sbt and Splay, however, cannot be used for persistence 233.
Roll back the rough

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.