With std::set, the time complexity of the operations:
insert: O(log N)
erase: O(log N)
begin, which outputs the min value: O(1)
rbegin, which outputs the max value: O(1)
Seems they have the same complexity requirement as a heap data structure.
So, can I use std::set as a heap data structure?
New contributor
Frank Wang is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.