Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void sort (struct project *a, long N,int (*comp)(struct project, struct project))
- {
- long i = 0, j = N-1;
- struct project p = a[ N/2 ];
- do
- {
- while (comp(p,a[i])) i++;
- while (comp(a[j],p)) j--;
- if (i <= j)
- {
- struct project temp = a[i];
- a[i] = a[j];
- a[j] = temp;
- i++; j--;
- }
- } while ( i<=j );
- if ( j > 0 ) sort(a, j,comp);
- if ( N > i ) sort(a+i, N-i,comp);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement