Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

selection sort c++

void swap(int &a, int &b)
{
    int temp = a;
    a = b;
    b = temp;
}
void Tri_Selection(int tab[],int n)
{
    for (int i=0; i<n; i++)
    {
        for (int j=i+1; j<n; j++)
            if (tab[i] > tab[j])
                swap(tab[i],tab[j]);
    }
}
 
PREVIOUS NEXT
Tagged: #selection #sort
ADD COMMENT
Topic
Name
8+5 =