constructor(size) {
    // The index of a cell is an id of the node in a set.
    // The value of a cell is an id (index) of the root node.
    // By default, the node is a parent of itself.
    this.roots = new Array(size).fill(0).map((_, i) => i);

    // Using the heights array to record the height of each node.
    // By default each node has a height of 1 because it has no children.
    this.heights = new Array(size).fill(1);
  }
Initializes the set of specified size.
@param {number} size