L21_Set

# L21_Set - What are Sets A new Data Structure that we learn...

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

What are Sets A new Data Structure that we learn is called a set . S 7 8 5 10 1 A set can be thought as an unbound collection of distinct elements. Page 1 of 31

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

View Full Document
What are Sets 7 8 7 8 5 10 1 A set can be thought as an unbound collection of distinct elements. Page 2 of 31
What are Sets S 7 8 5 10 1 S = {1, 5, 7, 8, 10} S = {7, 5, 8, 1, 10} S = {10, 1, 8, 5, 7} S = {10, 5, 1, 8, 7} S = {8, 1, 10, 7, 5} Page 3 of 31

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

View Full Document
Set Operation: union The union operation returns the results of merging two sets. 3 2 1 A 6 7 3 B 7 3 6 1 2 C =union( A , B ) Page 4 of 31
Set Operation: union The union operation returns the results of merging two sets. 3 2 1 A 6 2 3 B ? C =union( A , B ) Page 5 of 31

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

View Full Document
Set Operation: union The union operation returns the results of merging two sets. 3 2 1 A 1 2 3 B C =union( A , B ) ? Page 6 of 31
Disjoint Sets Two sets are disjoint if they do not share any elements. 4 2 1 A 6 9 3 B The sets A and B are disjoint. Page 7 of 31

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

View Full Document
Disjoint Sets Two sets are disjoint if they do not share any elements. 4 2 1 A 6 9 2 B The sets A and B are NOT disjoint. Page 8 of 31
Disjoint Sets Are all these sets disjoint? 3 5 2 A 8 7 4 B C 8 6 D 9 1 YES / NO Page 9 of 31

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

View Full Document
Disjoint Set Operation: Find 4 2 1 A 6 B C 5 7 D 8 9 3 A , B , C , D .find(8) = ___ Page 10 of 31
Disjoint Set Operation: Find 4 2 1 A 6 B 8 C 5 7 D 8 9 3 A , B , C , D .find(8) = ___ Page 11 of 31

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.

## This note was uploaded on 12/28/2010 for the course CSC CSC1110 taught by Professor Cjyuan during the Fall '06 term at CUHK.

### Page1 / 31

L21_Set - What are Sets A new Data Structure that we learn...

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

View Full Document
Ask a homework question - tutors are online