Summary: Balance Tree

Source: Internet
Author: User

The Balance Tree is probably the most commonly used high-level data structure, while treap is used for general information maintenance, and splay is used for advanced information maintenance (such as interval operations and LCT) (MAP, set party self-respect Qaq ).

Tips and notes:

There are many details.

In treap, if a small root heap is set (it is best to set a small root heap), the weight of null must be set to INF.

The duplicate elements in the balance tree can be used as needed.

The rank and select in the balance tree should be combined with the previous considerations.

In splay, if you write LCT, You need to determine the root. In many cases, pointer reference is required for treap, and splay is not required. After writing it, you 'd better create several sets of hentai data (corresponding to the requirements of the question) and check whether re or WA is used.

The array must not be small, but should be large if it can be opened.


Treap: [bzoj] 3224: tyvj 1728 normal balance tree (an unscientific OJ), [bzoj] 3196: tyvj 1730 binary Force Balance Tree (K in the interval + decision tree ), [bzoj] 1146: [ctsc2008] Network Management Network (tree link splitting + line segment tree cover Balance Tree + binary/DFS sequence + tree array + Chairman tree), [bzoj] 1862: [zjoi2006] Gamez game ranking system & 1056: [haoi2008] ranking system (treap + very careful)

Splay: the template and its details. For details, refer to [bzoj] 1507: [noi2003] Editor (splay) and [bzoj] 1901: zju2112 dynamic rankings (number K in the interval + decision tree), [bzoj] 1503: [noi2004] splay, and then LCT. Let's take a look at another topic ..


Summary: Balance Tree

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: 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.