runs selectionsort algorithm on a list of numbers