Slide1 l.jpg
This presentation is the property of its rightful owner.
Sponsored Links
1 / 7

Sets PowerPoint PPT Presentation


  • 98 Views
  • Uploaded on
  • Presentation posted in: General

Sets. Model Notation Sub-Sets Operations (abstract) Operations (ADT) Specialized ADTs based on Set. Sets – the Model. Set: a collection of elements (members) without repetition {a, b, c, ... } Usually, there is a linear order specified on the members specified somewhere else!

Download Presentation

Sets

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Slide1 l.jpg

Sets

Model

Notation

Sub-Sets

Operations (abstract)

Operations (ADT)

Specialized ADTs based on Set

CS 303 – Sets

Lecture 8


Sets the model l.jpg

Sets – the Model

  • Set: a collection of elements (members) without repetition

  • {a, b, c, ... }

  • Usually, there is a linear order specified on the members

  • specified somewhere else!

  • not based on “position”

  • Well Defined: if a,b S, then either a < b, a = b, or b < a

  • Transitive: if a,b,c S, then (a<b) and (b<c) implies (a<c)

CS 303 – Sets

Lecture 8


Set notation l.jpg

Set Notation

  • {1, 2, ..., 1000} = {x | 0 < x <= 1000}

  • {1, 4} = {4, 1} <> {1, 4, 1} (which is not a set!)

  • Membership

  • x A - x is an element (member) of A

  • x A - x is not an element of A

  • Null Set

  • NULL

CS 303 – Sets

Lecture 8


Sub sets l.jpg

Sub-Sets

  • A is a SubSet of B

  • A is included in B

  • B is a SuperSet of A

  • A is a subset of A

  • NULL is a subset of A

  • If A is a Subset of B and B is a Subset of A then A = B

  • if A is a Subset of B and A <> B then A is a proper subset of B

CS 303 – Sets

Lecture 8


Abstract set operations l.jpg

(abstract) Set Operations

  • Union: A union B = {x | (x is in A) OR (x is in B)}

  • Intersection: A intersect B = {x | (x is in A) AND (x is in B)}

  • Difference: A-B = {x | (x is in a) AND (x is NOT in B)}

  • [show Venn Diagrams]

CS 303 – Sets

Lecture 8


Set adt operations l.jpg

Set ADT - Operations

  • MakeNull(A): A = NULL

  • Member(x,A): b = (x is in A?)

  • Union(A,B,C): C = A UNION B

  • Intersection(A,B,C): C = A INTERSECT B

  • Difference(A,B,C): C = A – B

  • Equal(A,B): A == B?

  • Assign(A,B): A = B

  • Insert(x,A): A = A UNION {x}

  • Delete(x,A): A = A – {x}

  • Min(A): x = a | (a in A)

  • and for all z in A, a <= z

  • Merge(A,B): if A INTERSECT B is NOT NULL

  • then C = A UNION B,

  • else UNDEFINED!

  • Find(x): A = Ai | x is in Ai

  • if U = {Ai | i<>j

  • implies Ai INTERSECT Aj = NULL}

CS 303 – Sets

Lecture 8


Specialized adts based on set l.jpg

Specialized ADTs based on SET

  • UID – Union, Intersection, Difference

  • IDM – Insert, Delete, Member (Dictionary)

  • I(DeleteMin) – Insert, DeleteMin (Priority Queue)

  • ...and more...much more...

CS 303 – Sets

Lecture 8


  • Login