completed selection sort