update selectionSort method