invariant for SelectionSorter