//
// Bubble
//

extern void Swap (int&, int&);

void
BubbleSort (int A[], int N) 
{ 
  bool Sorted = false; 
 
  for (int Pass = 1; (Pass < N) && !Sorted; ++Pass)
    { 
       Sorted = true; 
       for (int Index = 0; Index < N - Pass; ++Index)
         if (A[Index] > A[Index+1]) 
           { 
              Swap (A[Index], A[Index+1]); 
              Sorted = false; 
           } 
     } 
}


