

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The instructions and requirements for completing a programming assignment in the cpsc 212-301 course. Students are tasked with implementing a mydisjointset class with methods find, unionbyheight, tostring, and treestructure for a disjoint set represented by an array x[]. The document also includes an honor pledge and submission instructions.
Typology: Exams
1 / 2
This page cannot be seen from the preview
Don't miss anything!


public MyDisjointSet (int x[]) { // ... your code ... } // MyDisjointSet
public int find(int u) { public void unionByHeight(int u, int v) { // ... your code ... // ... your code ... } // find } // unionByHeight
public String toString() { // ... your code ... } // toString
i: 0 1 2 3 4 5 6 7 x[]: 6 2 4 4 -4 -2 -2 5
public String treeStructure () { // ... your code ... } // treeStructure
i: 0 1 2 3 4 5 6 7 x[]: 6 2 4 4 -2 -1 -1 5
roots: 4 5 6 children of 4: 2 3 children of 2: 1 children of 5: 7 children of 6: 0