Winner tree and loser tree-qianye0905-blog garden winner tree and loser tree

Source: Internet
Author: User

Winner tree and loser tree-qianye0905-blog Garden

Winner tree and loser tree

The winner tree and the loser tree are both completely Binary Trees and are a variant of tree-based sorting. Each leaf node is equivalent to a player, each intermediate node is equivalent to a game, and each layer is equivalent to a round of competition.

The difference is that the middle node of the winner tree records the number of the winner, while the middle node of the loser tree records the number of the loser.

The winner tree and the loser tree can find the greatest value in log (n) time. After the value of any leaf node changes, you can use the information of the intermediate node to quickly find the maximum value. It is often used in K-path Merge Sorting.

I. Winner tree

One advantage of the winner tree is that if the value of a contestant changes, the winner tree can be easily modified. You only need to modify the binary tree along the path from the node to the root node, without changing the results of other competitions.

The winner tree and the loser tree are both completely Binary Trees and are a variant of tree-based sorting. Each leaf node is equivalent to a player, each intermediate node is equivalent to a game, and each layer is equivalent to a round of competition.

The difference is that the middle node of the winner tree records the number of the winner, while the middle node of the loser tree records the number of the loser.

The winner tree and the loser tree can find the greatest value in log (n) time. After the value of any leaf node changes, you can use the information of the intermediate node to quickly find the maximum value. It is often used in K-path Merge Sorting.

I. Winner tree

One advantage of the winner tree is that if the value of a contestant changes, the winner tree can be easily modified. You only need to modify the binary tree along the path from the node to the root node, without changing the results of other competitions.

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.