Mark As Completed Discussion

The Investigation Continues: Merging More Neighborhoods

As we dig deeper, we find another road connecting intersections 0 and 2. Just like before, these two intersections belong to different neighborhoods. So let's merge them!

Step 1: The Next Merge with Union(1, 2)

We bring together the neighborhoods of 1 and 2. Remember, neighborhood 1 already includes 0, so this merge will form a larger group.

Updating the Investigation Board

Step Seven

Step 2: Decoding the Parent Array's Latest Update

Now the value under 1 is changed to 2. This means 2 is now the head of this larger neighborhood, representing the union set {0, 1, 2}. It's like 2 has become the new head of the family, absorbing members from other smaller families.

Step 3: On to the Next Clue - Edge (1, 3)

We're not done yet! Let's turn our attention to the road connecting intersections 1 and 3. What will happen this time? Will 3 join this ever-expanding neighborhood, or is it part of a different group? Are we nearing the discovery of a loop in our city's road network?

SNIPPET
1Find(1) = 2  # 1 is part of the bigger neighborhood represented by 2
2Find(3) = 3  # 3 is still its own neighborhood

Notice that Find(1) gives us 2 because 2 is now the parent-- and Find(3) gives us 3.