
Advanced Data Structures 469
Fig. 10.14 Various set operations
S1
S2
S1
S2
(a) Union (b) Intersection
(c) Difference (d) Subsect
S2
S1
S1
S2
n Difference of sets: Given two sets S1 and S2, the difference S1 2 S2 is defined as the set having
all the elements which are in S1 but not in S2.
Example: If S1 5 {1, 3, 4}, S2 5 {3, 2, 5},
then S1 2 S2 5 {1, 4}.
The graphic representation of various operations related to sets is shown in Figure 10.14.
n Partition: It is a collection of disjoint sets belonging to same Universe. Thus, the union of all the
disjoint sets of a partition would comprise the Universe.
10.2.1 Representation of Sets
A set can be represented ...