Difference between revisions of "Computer Science/61b/Homework/hw9/set/DisjointSets.java"
< Computer Science | 61b | Homework | hw9 | set
m (moved CS 61b/Homework/hw9/set/DisjointSets.java to CS/61b/Homework/hw9/set/DisjointSets.java: fix cs 61b hierarchy) |
|
(No difference)
| |
Revision as of 06:00, 14 November 2010
/* 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.