Algorithms Week 1 -- Union Find java code