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

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

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.

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