S represents the set of integers from 1 to n. Consider the union-find data structure where - besides the operations union(A, B) and find(x) - you are interested in returning the minimum element of the set to which x belongs.
Suggest a data structure that allows you to efficiently implement these operations and analyze the running time for a sequence of m find, p findMin and at most (n - 1) unions.
I know that I should somehow sort the elements of the set to which x belongs (so, I first find the set, then I sort it and that should take O(nlogn) plus the time used by the find operation, which depends on the data structure...). Should I use the Union-find with balanced unions and path compression? Sorry, but I'm very confused!