# Thread: Making a Selection Sort into a Recursive Function with a Vector

1. ## Making a Selection Sort into a Recursive Function with a Vector

Just need to convert my working selection sort function into a recursive one. I don't understand recursive functions very well so any explanation or assistance is much appreciated.
Code:

Code:
```sort(vector<int> unsorted_list)
{
int temp, min;

for( int x = 0; x < unsorted_list.size()-1; x++)
{
min = x;
for (int j = min+1; j < unsorted_list.size(); j++)
{
if (unsorted_list[j] < unsorted_list[min])
min = j;
}
temp = unsorted_list[x];
unsorted_list[x] = unsorted_list[min];
unsorted_list[min] = temp;
}
return unsorted_list;
}```
Thanks.

PS: Declaration needs to remain the same. I realize that only one input is obscure but that is required -.-

2. It cant be done with that as the declaration.
First off it's missing the type and thus cannot compile, secondly there is no way for the sorted data to leave the function.
Lastly, passing a vector by value is a bad idea.