Selection sort algorithm implementation