#include "sort.h" void combSort(int* order, float* dist, int amount) { float tf; int ti; int gap = amount; int swapped = 0; int i; while(gap > 1 || swapped) { //shrink factor 1.3 gap = (gap * 10) / 13; if(gap == 9 || gap == 10) gap = 11; if (gap < 1) gap = 1; swapped = 0; for (i = 0; i < amount - gap; i++) { int j = i + gap; if (dist[i] < dist[j]) { tf = dist[i]; dist[i] = dist[j]; dist[j] = tf; ti = order[i]; order[i] = order[j]; order[j] = ti; swapped = 1; } } } }