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: Lecture 22 - Set Definitions and Implementations, Slides of Data Structures and Algorithms

The concepts of sets, including base types, cardinality, set operations, and their logical and implementation aspects. The definitions of sets, their properties, and the two common ways to implement sets: explicit (bit vector) and implicit (list). It also discusses why using a sortedlist adt for the implicit representation is a better choice, despite sets being inherently unordered.

Typology: Slides

2012/2013

Uploaded on 04/23/2013

saratey
saratey 🇮🇳

4.3

(10)

87 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Chapter 9
Sets
Lecture 22
Docsity.com
pf3
pf4
pf5

Partial preview of the text

Download Sets: Lecture 22 - Set Definitions and Implementations and more Slides Data Structures and Algorithms in PDF only on Docsity!

Chapter 9 Sets

Lecture 22

ADT Set Definitions

Base type: The type of the items in the set

Cardinality : The number of items in a set

Cardinality of the base type : The number of items in the base type

Union of two sets: A set made up of all the items in either sets

Intersection of two sets : A set made up of all the items in both sets

Difference of two sets : A set made up of all the items in the first set that are not in the second set

Implementing Sets

Explicit implementation (Bit vector)

Each item in the base type has a representation

in each instance of a set.

The representation is either

true (item is in the set) or

false (item is not in the set).

Space is proportional to the cardinality of the

base type.

Algorithms use Boolean operations.

Implementing Sets (cont.)

Implicit implementation (List)

The items in an instance of a set are on a list

that represents the set.

Those items that are not on the list are not in

the set.

Space is proportional to the cardinality of the

set instance.

Algorithms use ADT List operations.