Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. public void union(T x, T y) {
  2. T representativeX = element2representative.get(x);
  3. T representativeY = element2representative.get(y);
  4.  
  5. for(T element : element2representative.keySet()) {
  6. if(!element2representative.get(element).equals(representativeY)) {
  7. continue;
  8. }
  9. element2representative.put(element, representativeX);
  10. }
  11. // TODO Homework 2.1
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement