implemented selection sort