selection sort algorithm implemented