Search code examples
algorithmarray-algorithms

what does the size of a tree means in weighted union find algorithm?


I saw that in union find it says:

Weighted quick-union. Rather than arbitrarily connecting the second tree to the first for union() in the quick-union algorithm, we keep track of the size of each tree and always connect the smaller tree to the larger.

what is defined as the size of each tree? what is the size?


Solution

  • It is defined in the later part of the page.

    Definitions. The size of a tree is its number of nodes