coursera's algorithms part 1: find/union