33 - 00:32:22 1 33 CS61B Lecture 33 Wednesday Today’s...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 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....
View Full Document

This note was uploaded on 02/21/2010 for the course CS 61B taught by Professor Canny during the Spring '01 term at Berkeley.

Page1 / 2

33 - 00:32:22 1 33 CS61B Lecture 33 Wednesday Today’s...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online