Professional Documents
Culture Documents
12 - Selection & Insertion & Bubble Sort
12 - Selection & Insertion & Bubble Sort
12 - Selection & Insertion & Bubble Sort
{
int a , b , minloc , temp ;
for(a = 0 ; a <= size - 2 ; a++)
{
minloc = a ;
for(b = a+1 ; b <= size-1 ; b++)
if(arr[b] < arr[minloc]) minloc = b ;
temp = arr[a] ; arr[a] = arr[minloc] ; arr[minloc] = temp ;
}
}