simple yet not so bad sorting algorithm