Disjoint Set Union find algorithm

Will the code described here work well with outputs other than 0 to n

@nirupama1,
Yes, it should, but you will hardly find problems, where that is the case.

In those cases map will be better i think.

@nirupama1,
Exactly, also you can map them to integers [1,n] and then proceed as usual.