Wednesday 28 June 2017

Bubble sort algorithm

void bubble_sort(int a[], int count)
{
 int i, j, temp;
 for(j = 1; j < count; j++)
 {
   for(i = 0; i < (count - j); i++)
   {
      if(a[i] >= a[i + 1])
      {
           //Swap a[i], a[i+1]
      }
   }
 }
} 
 
 

No comments:

Post a Comment