top button
Flag Notify
Site Registration

How tinyurl generates unique code with 6 lettered string ?

+1 vote
387 views

Which data structure they will be using and how it generates short url even for each site link with uniqueness ?

posted Jun 22, 2015 by Sachidananda Sahu

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Get a unique random string for the given url and store it in the DB against the URL in the DB. Once it is in the db you just need to fetch the DB and get the original URL to decode.

Check the sample implementation here -
https://trinitytuts.com/simple-url-shortener-script-using-php-mysql-2/

answer Jun 22, 2015 by Salil Agrawal
Similar Questions
+3 votes

I want to add table to the database dynamically through code on runtime. Note: I want to add tables at any point of time.

...