Lecture 17

# Introduction to Algorithms, Second Edition

• Notes
• davidvictor
• 3

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

The University of Texas at Austin Lecture 17 Department of Computer Sciences Professor Vijaya Ramachandran Disjoint Sets Data Structure CS357: ALGORITHMS, Spring 2006 A disjoint-sets data structure maintains a collection of S = { S 1 , S 2 , · · · , S k } of disjoint sets, i.e., S i S j = φ if i negationslash = j . Each set in S is identified by a representative (or ‘rep’), which is an element in the set. The following operations are supported: Make-set ( x ). creates a new one-element set { x } whose representative is x . (For correctness it is required that element x is not already present in another set in the collection. Union ( x, y ). Here, x and y are elements in the current collection of sets. This operation creates the set S T , thereby removing S and T from S . Find-set ( x ). Given a pointer to an element x in the collection, returns a pointer to the representative of the set containing x . We will assume that we start with the initially empty collection. We will analyze the running time of a data structure in terms of n , the number of Make-set operations (which is also the number of elements in the collection), and m , the total number of Make-set, Union and Find-set operations executed.

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

This is the end of the preview. Sign up to access the rest of the document.
• Spring '06
• Ramachandran
• Algorithms, representative, Array data structure, path compression, Find-set

{[ 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