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 -.-