selection sort and comparison