Implement weighted version of quickUnion