Implement a selection sort algorithm to sort a list of varying length