Recursive selection sort