refers to the use of the std::map or std::unordered_map containers from the Standard Template Library (STL).
Map
These containers are used to store key-value pairs, where each key is unique, and it maps to a specific value.
Map
stores elements in a sorted order based on the key. Underlying Data Structure: Typically implemented as a Red-Black Tree.
Ordered Map
Insert, Delete, Search → O(log n)
Ordered Map
Does not store elements in any particular order or stores key-value pairs with no specific order.
Unordered Maps
Average case → O(1) or Worst case → O(n) (rare)
Unordered Maps
A fundamental data structure in computer science that represents a collection of unique elements with no particular order.
Sets
are widely used in algorithms and problem-solving due to their efficient membership testing and distinct element properties
Sets
What are the common operations for sets
insert()
erase()
find()
set_union()
set_intersection()
set_difference()
size()
empty()
Add a new element to the set
insert()
Removes an element from the set
erase()
Checks if an element exists in the set
find()
Combines two sets
set_union
Finds the common elements between two sets
set_intersection()
Finds elements in one set but not in another
set_difference()
Gets the number of elements in the set
size()
Checks if the set is empty
empty()