Saturday, 16 July 2011

Bubble Sort.


for ( i = 0 ; i <= 3 ; i++ )
 {
  for ( j = 0 ; j <= 3 - i ; j++ )
  {
   if ( arr[j] > arr[j + 1] )
   {
    temp = arr[j] ;
    arr[j] = arr[j + 1] ;
    arr[j + 1] = temp ;
   }
  }
 }

No comments:

Post a Comment