i also thought its relative to database but ultimately  it also
depends on the data structure & Algorithms used by database to
implement the particularly query.
The simpler implementation of this service is to store, in a database
table, a data pair (id, url) where your id has the autoincrement
option, e.g.

1 -> www.facebook.com
2 -> www.otherurl.com/path/complete/to/the/page.php
3 -> ... so on

So when a user ask for http://tinyurlservice.com/1 you simply do a
select into your table (select url from urlstable where id = '1') and
then you do a redirect to that url.

You could refine this, looking before if a certain url was already
'tinyurled' (so you prevent multiple insertions of the same url), you
could add a date field in your table and delete the older entries with
a stored procedure or with a cronjob or with an admin panel... and so
on.

1 have another approach using temp. array of all chars that a url can
contains  will explorer later..

Hope this will be useful for you., Correct me if anything wrong


Thanks
Shashank
CSE,BIT Mesra

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to