Sort:  

interesting. Don't quite understand why your algorithm equals mine, and unfortunately I'm too lazy to think about it at the moment ;)