About this question

Expected Hash Collisions

Medium · Number Theory & Algorithms · Quant Trader interview question · probability, hashing, birthday-paradox, algorithms

Your team is building a high-frequency trading system. You're using a hash table to quickly look up order IDs. You have $M$ buckets in your hash table. You expect to insert $N$ order IDs into the table. Approximately how large can $N$ be before you should expect a hash collision? Assume a perfectly uniform hash function.