How URL shortening scripts work?
I have been quite intrigued with the working of these URL shortner scripts and surprisingly most of them employ an ingenious solution to compress the URL to a shortened one.
http://example.com/fe45 ——-> http://corpocrat.com/blah/page.htm
The answer is base36 encoding. why base36? because it can contain 26 alphabets and 10 numbers in the output. This is surprisingly simple way of encoding a URL.
Base 36 is nothing but, you keep on dividing a number by 36, collect its reminders (or modulo) and map them …

