Finding max key in an unordered_map in c++

Viewed 3890

This question is similar to this question, but I need to find it in an unordered_map (hashMap) instead of a map. Since the elements in an unordered_map are obviously unordered, I cannot use the logic mentioned in the similar question.

So, is there some way (other than sequential iteration) to find out the maximum key in an unordered_map? That is, preferably in O(1) or O(logN) rather than O(n)?

Thanks!

1 Answers
Related