Good luck, you'll need it!
There's no algorithm that you can code into your application since DST is done at government level (on a vote around a table).
Do a few searches on Google with "daylight saving algorithm" or whatever, and pages like this crop up http://www.timeanddate.com
I supose it can be done for major locations but you'll need to keep checking for governments fiddling with things.
--
Roger