33 - 00:32:22 CS61B Lecture 33 Wednesday Todays reading...

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

View Full Document Right Arrow Icon
04/15/09 00:32:22 1 33 CS61B: Lecture 33 Wednesday, April 15, 2009 Today’s reading: Goodrich & Tamassia, Section 11.6. DISJOINT SETS ============= A _disjoint_sets_ data structure represents a collection of sets that are _disjoint_: that is, no item is found in more than one set. The collection of disjoint sets is called a _partition_, because the items are partitioned among the sets. Moreover, we work with a _universe_ of items. The universe is made up of all of the items that can be a member of a set. Every item is a member of exactly one set. For example, suppose the items in our universe are corporations that still exist today or were acquired by other corporations. Our sets are corporations that still exist under their own name. For instance, "Microsoft," "Forethought," and "Web TV" are all members of the "Microsoft" set. We will limit ourselves to two operations. The first is called a _union_ operation, in which we merge two sets into one. The second is called a _find_ query, in which we ask a question like, "What corporation does Web TV belong to today?" More generally, a "find" query takes an item and tells us which set it is in. We will not support operations that break a set up into two or more sets (not quickly, anyway). Data structures designed to support these operations are called _partition_ or _union/find_ data structures. Applications of union/find data structures include maze generation (which you’ll do in Homework 9) and Kruskal’s algorithm for computing the minimum spanning tree of a graph (which you’ll implement in Project 3). Union/find data structures begin with every item in a separate set. -------------- ------------ -------- ------------------- -------- ----------- |Piedmont Air| |Empire Air| |US Air| |Pacific Southwest| |Web TV| |Microsoft| -------------- ------------ -------- ------------------- -------- ----------- The query "find(Empire Air)" returns "Empire Air". Suppose we take the union of Piedmont Air and Empire Air and called the resulting corporation Piedmont Air. Similarly, we unite Microsoft with Web TV and US Air with Pacific SW. -------------- ------------------- ----------- |Piedmont Air| | US Air | |Microsoft| | Empire Air | |Pacific Southwest| | Web TV | -------------- ------------------- ----------- The query "find(Empire Air)" now returns "Piedmont Air". Suppose we further unite US Air with Piedmont Air. -------------------------------- ----------- | US Air Piedmont Air| |Microsoft| |Pacific Southwest Empire Air | | Web TV | -------------------------------- ----------- The query "find(Empire Air)" now returns "US Air". When Microsoft takes over US Air, everything will be in one set and no further mergers will be possible.
Image of page 1

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

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