This looks like the old bubble sort algo. I guess that with many elements it will take cosiderable time, won't it?

Ioannis