Interview Bootcamp
Ask Author
Back to course home

0% completed

Vote For New Content
Vivek Patil
wrong line in MD5 hashing section?

Vivek Patil

Aug 13, 2024

We can take the first 6 (or 8) letters for the key. This could result in key duplication; to resolve that, we can choose some other characters out of the encoding string or swap some characters.

What are the different issues with our solution? We have the following couple of problems with our encoding scheme:

  1. If multiple users enter the same URL, they can get the same shortened URL, which is not acceptable.

Instead of 'same', shouldn't it be 'different' word in point 1? The point is irrespective of the user, any given long URL should always create a unique short URL. Am I missing something here?

0

0

Comments
Comments
H
htsondk251 7 days ago

Because you use hash as primary key, so, it cannot have 2 record with the same pk.

Imagine the case when 2 users want to shorten the same url (ex: website to get weather info), but the one who tries later cannot proceed. It make him confusing.