Posts tagged hashtable

Hash tables

:: STL, hashtable, unordered_map

Before C++11, hash tables could be used in C++ only with some tricks. The only associative container available in the STL used to be the std::map (along with its sibling, the multimap). This class, however, is implemented as a binary search tree, and does not provide a way to customize a hash function. What hurt me most was that you didn’t have the great performances offered by a true hash map: almost constant time insert, delete, and search (depending on how good is the hash function). You insert in O(log N) time. You find in O(log N) time. Too bad.