Friday, July 22, 2016

C++ Solution to UVA 10608 - Friends Union by Rank and Path Compression


Problem Link:
https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1549
These are my old codes I kept for visual explanations but I lost all the data. Since these are old codes I can not remember if I made any breaking changes to the code later. For the algorithm please see Introduction to Algorithms book.

Problem Explanation & Visalization:

TODO

Input & Output Explanation:

TODO

Input & Output:

Input:
2 3 2 1 2 2 3 10 12 1 2 3 1 3 4 5 4 3 5 4 6 5 2 2 1 7 1 1 2 9 10 8 9

Output:
3 7

More input and output in udebug:
https://www.udebug.com/UVa/10608

Code:


No comments: