/*
   Comb sort
   Public domain. Not tested.
*.

int newGap(int gap)
{       
        gap=gap*10/13;
        if(gap==9 | | gap==10)  gap=11;
        if(gap < 1)  return 1;
        return gap;
}
        
// The array and the size of the array
void sort(int a[], int size)
{
        int gap=size;
        int i;

        bool swapped;
        do
        {       
               swapped=false;
                gap=newGap(gap);
                for(i=0; i < size - gap; i++)
                {    
                       if(a[i] > a[i+gap])
                        {       
                                swapped=true;
                                int temp=a[i];
                                a[i]=a[i + gap];
                                a[i + gap]=temp;
                        }
                }
        } 
        while(gap > 1 || swapped);
}

