http://en.wikipedia.org/wiki/Reverse_Polish_notation

The algorithm is on this site. Hope this helps.