Changes

Jump to: navigation, search

Computer Science/61b/Homework/hw9/set/DisjointSets.java

760 bytes added, 06:48, 22 September 2007
no edit summary
/* 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 {

{{notmine|Jonathan Shewchuk}}
1,277
edits

Navigation menu