recursive selection sort