{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# lec0418-DS - Announcements MP 6 regrade window extended...

This preview shows pages 1–4. Sign up to view the full content.

Announcements: MP 6 regrade window extended indefinitely. Late penalty waived. MP7 available. Due soon. Start now. Today: Disjoint Sets A Disjoint Sets example: Let R be an equivalence relation on the set of students in this room, where (s,t) R if s and t have the same favorite among {AB, FN, DJ, ZH, PvZ}. 0 1 4 8 2 5 9 3 6 7 1. Find(4) 2. Find(4)==Find(8) 3. If (!(Find(7)==Find(2)) then Union(Find(7),Find(2))

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Disjoint Sets ADT We will implement a data structure in support of “Disjoint Sets”: Maintains a collection S = {s 0 , s 1 , … s k } of disjoint sets. Each set has a representative member. Supports functions: A first data structure for Disjoint Sets: Find: Union: void MakeSet(const T & k); void Union(const T & k1, const T & k2); T & Find(const T & k);
0 1 2 3 0 1 2 3 0 1 2 3 A better data structure for Disjoint Sets: UpTrees • if array value is -1, then we’ve found a root, o/w value is index of parent. • x and y are in the same tree iff they are in the same set.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern