You are on page 1of 9

Sets And Disjoint Sets

• Definition
• A set is defined as a collection of distinct objects of same
type or class of objects.The objects of a set are called
elements or members of set.Objects can be
number,alphabets,names etc. e.g A={1,2,3,4,5}
• Given a  set  of elements, it is often useful to break them
up or  partition  them into a number of  separate,
nonoverlapping sets .
• A  disjoint-set data structure  is a  data structure  that
keeps track of such a partitioning.
• S1={1,7,8,9} S2={2,5,10} S3={3,4,6} are three disjoint sets.
• Operation we can perform:
• A  union-find algorithm  is an algorithm that
performs two useful operations on such a data
structure :
• Find : Determine which set a particular element
is in. Also useful for determining if two elements
are in the same set.
• Union : Combine or merge two sets into a single
set.
• Representation of sets-
• 1)Tree Representation
• 2) Data Representation
• 3) Array Representation
Tree Representation
Union of Set

You might also like