This is a fascinating article:
PROBLEM: You are a web programmer. You have users. Your users rate stuff on your site. You want to put the highest-rated stuff at the top and lowest-rated at the bottom. You need some sort of “score” to sort by.
The article goes into detail about how all the most common sorting algorithms are incorrect. We implemented a system a while back, using wrong solution #2 (from the article), and had all sorts of issues with things getting sorted incorrectly. The proposed algorithm looks rather scary though.
Need to keep this in mind when I next implement a rating-based system.
UPDATE: Another article, now bringing in a time component.