Chapter 1 Set
Chapter 1 Set
Chapter 1 Set
SCJ 3203
Programme Educational Objectives
• Ability to acquire and apply theory and principles of Computer Science and equip
with social science and personal development knowledge.
• Ability to design and construct computer programs using standard approaches
• Ability to identify, formulate and solve real world problems through software
engineering principles and methodologies, and to creatively produce software
artifacts using current tools and techniques
• Ability to present technical solutions to a range of audience
• Ability to think critically and creatively in order to solve real world problem
• Ability to work effectively in a team
• Ability to undertake lifelong learning and actively participate in change
• Ability to identify business opportunity and develop entrepreneurship skill
• Ability to function effectively and with responsibility as a leader to achieve
common goals
• Ability to demonstrate behaviors that are consistent with the Code of
Professional Ethics and Responsibilities
A B
A U B
Sept2011 Theory of Computer Science 35
Set operations: Union
• Formal definition for the union of two
sets:
A U B = { x | x A or x B }
• Further examples
– {1, 2, 3} U {3, 4, 5} = {1, 2, 3, 4, 5}
– {Johor, Melaka} U {3, 4} = {Johor, Melaka,
3, 4}
– {1, 2} U = {1, 2}
Sept2011 Theory of Computer Science 36
Set operations: Intersection
• The intersection of sets A and B, written A B, is a set that
contains all the elements in both A and B.
A B
A ∩ B
Sept2011 Theory of Computer Science 37
Set operations: Intersection
• Formal definition for the intersection of
two sets: A ∩ B = { x | x A and x B }
• Further examples
– {1, 2, 3} ∩ {3, 4, 5} = {3}
– {Johor, Melaka} ∩ {3, 4} =
• No elements in common
– {1, 2} ∩ =
• Any set intersection with the empty set yields
the empty set
A B
A B
A B