Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Sets: Concept, Notation, and Operations, Lecture notes of Computer Science

An introduction to sets, including their concept, notation, and basic operations such as union, intersection, and difference. The document also discusses the relationship between sets and logic, as well as the use of sets in perl programming. Sets are collections of unique elements, and this document covers their representation and manipulation.

Typology: Lecture notes

2012/2013

Uploaded on 04/23/2013

ashwini
ashwini 🇮🇳

4.5

(18)

177 documents

1 / 28

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
represents an unordered collection
with no duplicates
A set S:
(an ordered collection is called a sequence)
(a set that can contain duplicates is often called a
multiset).
Sets
Saturda y, September 1 8, 2010
11:24 AM
Sets Page 1
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c

Partial preview of the text

Download Sets: Concept, Notation, and Operations and more Lecture notes Computer Science in PDF only on Docsity!

represents an unordered collection with no duplicates A set S: ( an ordered collection is called a sequence) ( a set that can contain duplicates is often called a multiset). Sets Saturday, September 18, 2010 11:24 AM Docsity.com

S = { "George", "Frank", "Susan" } is a set of three strings. "George" ϵ S "George is in S" "Sue" ϵ S "Sue is not in S" T = {"George"} T S "T is a subset of S": true S T "S is a superset of T": true T S "T is either a subset of S or equal to S": true S T "S is either a superset or equal to T": true T S "T is a proper subset of S": true S T "S is a proper superset of T": true T S "T is not a subset of S": false S T "S is not a superset of T": false A proper subset of S is a set T such that there exists at least one element in S that is not in T. Set notation Saturday, September 18, 2010 11:26 AM Docsity.com

Sets are circles Overlaps are depicted as overlaps between circles Particular diagrams represent specific conditions We often notate the relationships between sets via Venn Diagrams Venn Diagrams Saturday, September 18, 2010 11:36 AM Docsity.com

Some common diagrams Saturday, September 18, 2010 11:37 AM Docsity.com

A few pictures of Venn Diagrams Wednesday, September 22, 2010 3:16 PM Docsity.com

Union: combining two sets Intersection: counting the common elements Difference: including what is not in another set Set operations Saturday, September 18, 2010 11:42 AM Docsity.com

The universal set U for a set S contains all possible candidate elements of S Several common universal sets: Universal set Saturday, September 18, 2010 11:49 AM Docsity.com

The set complement of a set is the set containing every element except the set. Complements depend upon the choice of universal set. Suppose U= Set complement Saturday, September 18, 2010 11:50 AM Docsity.com

Note the intimate relationship between sets and logic It is not surprising that rules of logic are analogous to rules for sets! Sets versus logic Saturday, September 18, 2010 12:05 PM Docsity.com

The DeMorgan Laws Saturday, September 18, 2010 12:08 PM Docsity.com

Theorem: Limited to 2 or 3 sets: 4 sets can't be drawn in the plane! Example of proof involving sets Saturday, September 18, 2010 12:10 PM Docsity.com

Theorem: Proof by logic Saturday, September 18, 2010 12:13 PM Docsity.com

Cloud model Wednesday, September 22, 2010 3:35 PM Docsity.com

Some common hash operations "speakers" => "kay"); %ownedBy = ("stereo" => "george", Initializing a hash: $ownedBy{"stereo"} is "george" $ownedBy{"speakers"} is "kay" but not necessarily in that order! keys %ownedBy is ("stereo", "speakers") after this, $ownedBy{"car"} = "leslie"; Adding data to a hash: but not necessarily in that order! keys %ownedBy is ("car", "speakers", "stereo") after this, delete $ownedBy{"stereo"}; Removing data from a hash: defined $ownedBy{"stereo"} is undef (false). but not necessarily in that order. keys %ownedBy is ("car", "speakers") after this, Hash operations Monday, September 20, 2010 10:46 AM Docsity.com