Please enable JavaScript.
Coggle requires JavaScript to display documents.
SETS DETAILED, NOTE - Coggle Diagram
SETS DETAILED
SETS
- SETS
- UNORDERED SETS
- MULTISETS
- UNORDERED MULTISETS
-
- Sets do not allow direct access to it's elements.
- There is no concept of front and back.
- Set is sorted
:checkered_flag: insert method is used to insert elements.
Returns a pair object
std::pair<iterator,bool>
First Returns an iterator to the inserted or duplicate element.
Second is a boolean indicating success or failure(presence of duplicate element)
:warning: Sets find method is different from the find function in STL, but we should use the set's find method because it knows the internal implementation of the set
-
UNORDERED SETS
-
- Elements cannot be modified
Must be erased and then inserted again.
- No reverse iterators are allowed
-
-
-
UNORDERED SET
:tada: Internally, the elements are not sorted in any particular order, but organized into buckets. Which bucket an element is placed into depends entirely on the hash of its value. This allows fast access to individual elements, since once a hash is computed, it refers to the exact bucket the element is placed into.
:checkered_flag: Container elements may not be modified (even by non const iterators) since modification could change an element's hash and corrupt the container.
NOTE
-
If you need to change the particular element you would have to erase it and then insert the new element.