3 ms·
The reason is that `std::find` is O(N) while `std::map::find` is O(1).
by clishem 10y ago
The reason is that `std::find` is O(N) while `std::map::find` is O(1).
- slavik81 10y agoIt doesn't affect your point, but std::map::find is O(log n). std::map is ordered and is typically a tree.
- WildUtah 10y agoYes, except the canonical map is—surprising the users of other collection frameworks—an ordered, balanced tree. So std::map::find() is O(ln n) while std::unordered_map::find() is O(1).