impl selection sort