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.