Блог пользователя Sahilamin219

Автор Sahilamin219, история, 3 года назад, По-английски

I was solving some DSU question and i m not able to understand when should we do path compression and when not . For example like in these two questions .

1.Redundant Connection

Solution 1

2.Redundant Connection II

Solution 2

For better idea of solution 2 visit

As you can see in 2nd question while finding cycle we are not doing path compression. If anyone can explain the concept behind this it would be very helpful.

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится