Difference between revisions of "Computer Science/61b/Homework/hw9/set/DisjointSets.java"
< Computer Science | 61b | Homework | hw9 | set
m (Lensovet moved page CS/61b/Homework/hw9/set/DisjointSets.java to Computer Science/61b/Homework/hw9/set/DisjointSets.java) |
|
(One intermediate revision by the same user not shown) | |
(No difference)
|
Latest revision as of 03:51, 20 February 2023
/* DisjointSets.java */ package set; /** * A disjoint sets ADT. Performs union-by-size and path compression. * Implemented using arrays. There is no error checking whatsoever. * By adding your own error-checking, you might save yourself a lot of time * finding bugs in your application code for Project 3 and Homework 9. * Without error-checking, expect bad things to happen if you try to unite * two elements that are not roots of their respective sets, or are not * distinct. * Current solution is to refuse to do the union and print an error message if any of the above-listed conditions are true * Elements are represented by ints, numbered from zero. **/ public class DisjointSets {
- The author of this file is Jonathan Shewchuk; consequently, I cannot make it freely available.