1 / 7

# Associative Containers - PowerPoint PPT Presentation

Associative Containers. CIS 237 – Data Structures. Sets. Stores keys Duplicates not allowed Simply needs to know if in set Used to implement the mathematical concept. 10. A. A 10. 5. !. H 34. 32. B. P 9. i. 90. B 77. ;. 27. Y 56. Set Examples. Set of characters.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about 'Associative Containers' - sanne

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

### Associative Containers

CIS 237 – Data Structures

• Stores keys

• Duplicates not allowed

• Simply needs to know if in set

• Used to implement the mathematical concept

A

A 10

5

!

H 34

32

B

P 9

i

90

B 77

;

27

Y 56

Set Examples

Set of characters

Set of integers

Set of counters

• s.count()

• s.empty()

• s.size()

• s.find(value)

• s.insert(value)

• s.erase(value)

• s.erase(itr)

• s.begin

• s.end

• Union (+)

• Intersection (*)

• Difference (-)

A 3

X 9

Maps

• Stores key-value pair

• map<t1, t2>::value_type entry(keyValue, value)

• Entries identified by key

• Two templates

• map<keyType, dataType> m

• map< keyType, dataType>::iterator itr

• m.insert(key_value_pair)

• m[key]

• m.erase(key)

• m.erase(itr)

• m.size

• m.empty

• m.begin

• m.end