Study NOTES: CDQ Division

Source: Internet
Author: User

This year's curriculum has a large part of the content is the CDQ division and its extension (that is, the binary grouping), after reading that it is quite useful, here a little summary. (In my case, I still have a lot of semi-finished articles in my drafts.) By the way thanks to the next FY and WXL introduced me to such a good thing)

Recommended papers:

1 "The application of a class of divide-and-conquer algorithm from " Chen Danqi

2 on several non-classical solutions of data structure problems Xu Hao

What is the difference between Q:CDQ and ordinary division?

A: In our usual division, each sub-problem only solves itself (which can be said to be closed). In CDQ division, for the two sub-problems, the former sub-problem is used to solve the latter sub-problem instead of itself.

In many problems (such as most data structure problems), we often need to deal with some dynamic issues. However, our handling of dynamic problems is not as convenient as static problems, so we have CDQ division. However, as mentioned in article 2, the premise of using this algorithm is that the problem must have the following two properties:

1. The modification operation is independent of the inquiry, and the modification operation does not affect the effect.

2. The topic allows offline algorithms to be used.

The specific algorithm flow is as follows:

1. Divide the entire sequence of operations into two equal-length parts (min)

2. Recursive processing of sub-problems in the previous part (rule 1)

3. Calculate the effect of the modification operation in the sub-problem of the previous part on the latter sub-problem (Governance 2)

4. Recursive processing of a subset of sub-problems (rule 3)

{

  The approximate step of CDQ Division is
1. Solve (L,mid)
2. Solve (MID+1,R)
3. Handling the left side effect on the right

}

In the process, the core is Step 3: Because the modification in the previous molecular problem is static processing relative to the latter part of the sub-problem, we can more easily calculate the latter part of the sub-problem.

CDQ Division is a relatively special kind of division, many problems into this kind of division, time and space will have a great savings, and it is not so troublesome to write.

The particularity of this kind of division and treatment of the two parts of the merger, the role of two parts in the merger when the role is different, for example, through the left half of the influence to update the right half, so before the beginning of the division to a certain keyword sort, and then use this order, consider an interval [L, R] two parts of the effect

Study NOTES: CDQ Division

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.