Lecture 4 - Sets - Sets (Computer Science Notes) Sets...

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

View Full Document Right Arrow Icon
Sets (Computer Science Notes) Sets Definition: A set is an unordered collection of objects {x Z | 3 ≤ x ≤ 7}, first part tells you that a variable x that ranges in the set and the second part gives you the constraints for the variable, separator (| or :) is often read “such that.” Things to be Careful About A set is an unordered collection. So {1, 2, 3} and {2, 3, 1} are two names for the same set. Each element occurs only once in a set. Or, alternatively, it doesn’t matter how many times you write it. So {1, 2, 3} and {1, 2, 3, 2} also name the same set We’ve seen ordered pairs and triples of numbers, such as (3, 4) and (4, 5, 2). The general term for an ordered sequence of k numbers is a k-tuple.1 Tuples are very different from sets, in that the order of values in a tuple matters and duplicate elements don’t magically collapse (1, 2, 2, 3) 6= (2, 2, 1, 3) Pair() Set{} ∅ - empty set Cardinality, Inclusion If A is a finite set (a set containing only a finite number of objects), then |A| is the number of (different) objects in A. This is also called the cardinality of A |{a, b, 3}| = 3 and |{a, b, a, 3}| is also 3, because we count a group of identical objects only once If A and B are sets, then A is a subset of B (written A B) if every element of A is also in B The notion of subset allows the two sets to be equal. So A A is true for any set A. So is like ≤ If you want to force the two sets to be different (i.e. like <), you must say that A is a proper subset of B, written A B. You’ll occasionally see reversed versions of these symbols to indicate the opposite relation B
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/16/2011 for the course CS 173 taught by Professor Erickson during the Spring '08 term at University of Illinois, Urbana Champaign.

Page1 / 3

Lecture 4 - Sets - Sets (Computer Science Notes) Sets...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online