Line tree and tree array problems supplement

Source: Internet
Author: User

1. Tree height of segment tree:

Here's the n=r-l+1, up to a log2n-1 point.

2. When the interval is queried, only two intervals per floor will be questioned. (A child whose father is completely covered will not be questioned on this level.) )

3. Total number of nodes in the segment tree

But actually we do the line tree, open the array, only twice times the *n is not enough (this refers to the heap storage of segment tree).

Then we use "construction method" to find the formula of the general term.

Get:

Therefore, at the bottom of the line tree, the maximum number may be close to 4*n, so the segment tree storage space is 4 times times.

4. Interval query

Line tree and tree array problems supplement

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.