3 ms·
boost::unordered_set is an in-memory hash table, not unlike std::hash_set (which may save you some download/link time). Note that the blog post discusses your
by DrJosiah 16y ago
boost::unordered_set is an in-memory hash table, not unlike std::hash_set (which may save you some download/link time). Note that the blog post discusses your options when your data is too large to fit in memory.
Most hash tables operate under the assumption (based on good hashing and probing algorithms) that hashed key collisions are somewhat common. If one were to apply hashing to this problem (data on disk), the data file would necessarily grow (hash tables rely on empty space to reduce the probability of collisions), and would still require at least 1 disk seek+read, but likely more depending on the characteristics of the particular hashing algorithm used.
Actually, since the original problem specified uses md5s as the key, arguably the best hash probe sequence and chaining would be something similar to interpolation search; which the index still beats.