Coupon Accepted Successfully!


Associative Containers

The associative container allows fast access to the object in the container. These containers are useful for huge dynamic tables in which we can search for an element randomly and sequentially. These containers use tree-like structures of elements instead of linked lists. These structures allow quick random update and retrieval operations. Associative containers are non-sequential and allow direct access to elements; these containers are divided into four categories:

1.     sets

2.     multisets

3.     maps

4.     multimaps

All the containers listed above hold data elements in a structure called a tree. The tree provides quick finding, deletions, and insertions. These containers perform very slowly in random access operations and are inappropriate for sorting operations.

Container sets and multisets store data elements. They also allow various operations to manage them. The variable name is used as a key name. Suppose a set contains objects of the player class. It can be sorted in ascending order using the names as keys. The multiset may have multiple sets of elements; that is, it permits duplicate data elements. The set does not allow duplicate elements.

Containers map and multimap stores both key names and values. The values are associated with key names. The values can be handled using key names. The values are also called mapped values. Multimaps allow various keys. Map containers permit single keys.

Test Your Skills Now!
Take a Quiz now
Reviewer Name