RamiScience
asked on
Sort By Selection Algorithm By RECURSION
Hello
I want the algorithm of :
Sort By Selection function of a array of integer elements
by RECURSION .
SortBySelec(int a[]; int n);
{
}
Thanks.................... .
I want the algorithm of :
Sort By Selection function of a array of integer elements
by RECURSION .
SortBySelec(int a[]; int n);
{
}
Thanks....................
Homework?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
void SortBySelec(int* a; int n);
{
if(n == 1) retun;
int j = 0;
for(int i=1; i<n; i++)
if(a[i] < a[0])
j = i;
a[0] = a[j];
SortBySelec(&a[1], n-1);
}
{
if(n == 1) retun;
int j = 0;
for(int i=1; i<n; i++)
if(a[i] < a[0])
j = i;
a[0] = a[j];
SortBySelec(&a[1], n-1);
}