/*
 *    sort.c
 *      ======
 *      setridi tahy podle jejich hodnot
 *
 */
#include "data.h"
void Sort(TMG mg, int h[], int p)
{
	int first, max, i, t;
	TTah tah;
	for (first = 0; first < p - 1; first++) {
		max = first;
		for (i = first + 1; i < p; i++)
			if (h[i] > h[max])
				max = i;
		if (max != first) {
			tah = mg[first];
			mg[first] = mg[max];
			mg[max] = tah;
			t = h[first];
			h[first] = h[max];
			h[max] = t;
		}
	}
}
/* void SortPart(int a, int b, TMG mg, int h[])
   {
   int pivot,i,j,t;
   TTah tah;
   if(a>=b) return;
   pivot=h[(int)((a+b)/2)];
   i=a; j=b;
   while(i<j) {
   while(h[i]>pivot) i++;
   while(h[j]<pivot) j--;
   if(i<j) {
   tah=mg[i]; mg[i]=mg[j]; mg[j]=tah;
   t=h[i]; h[i]=h[j]; h[j]=t;
   i++;j--;
   }
   }
   SortPart(a,j,mg,h);
   SortPart(j+1,b,mg,h);
   } */
