Skip to main content

multiset

Use as an better alternative for Priority Queue

caution

Basic operations are of O(log n)

....

....

erase()

caution

Time Complexity is :~ O(log n)

caution

multisetName.erase(element) erases all the instances of that element in the multiset.

multisetName.erase("abc")

multisetName.erase(iteratorName) only erases the element at that iterator.

auto it = multisetName.find("abc");
if (it != s.end()) // if "abc" is present; i.e. Iterator "it" is not equal to "end()"
{
multisetName.erase(it); // ONLY erase element at Interator "it"
}