educative.io

Educative

Quiz, probability of collision

I think this answer is very strange and means that there is an inverse relation between number of URLs in the db and the probability of collision, and based on this equation, the probability of collision is 100% if there is just one record in the db!


Course: Grokking Modern System Design Interview for Engineers & Managers - Learn Interactively
Lesson: Design and Deployment of TinyURL - Grokking Modern System Design Interview for Engineers & Managers

Hi @MohammadNoor_Ali

Thank you for pointing out the error. The correct answer would be “n/total number of combinations”. With growing n, the collision probability would increase, ranging from 0 when n=0 and 1 when n=total number of combinations.

This calculation assumes that the user’s selection of a custom short URL is random and equally likely from the set of allowed combinations.

I’ve updated the lesson content accordingly.

2 Likes