{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

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

View Full Document Right Arrow Icon
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))
Image of page 1

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

View Full Document Right Arrow Icon
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);
Image of page 2
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.
Image of page 3

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

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern