disjoint subsets method added