⚡ Build the skills to land top-paying quant jobs. Offer ends in 17d 22h 20m 23s17 days 22 hours 20 minutes 23 seconds.
⚡ Build the skills to land top-paying quant jobs. Offer ends in 17d 22h 20m 23s17 days 22 hours 20 minutes 23 seconds.

Sign in to watch this lesson
Algorithms - Linear Data Structures · 3:55
We open up std::unordered_map on this Mac's libc++: integers hash to themselves, the bucket is the hash modulo a prime bucket count, colliding keys share a chain of heap nodes, and the table rehashes through a fixed list of primes. Knowing that list, an attacker sends 50,000 multiples of 51,437 and every key lands in one bucket, so inserts turn quadratic (over a second here, against a couple of milliseconds for random keys). A seeded splitmix64 hash scatters the same keys and keeps the clock flat; we finish with composite keys and when not to hash at all.