class Program { static void gyors(int[] tomb, int bal, int jobb) { if(bal < jobb) { int also = bal, felso = jobb + 1, kulcs = tomb[bal]; for( ; ; ) { while(++also < felso && tomb[also] < kulcs) ; while(tomb[--felso] > kulcs) ; if(also >= felso) break; csere(tomb, also, felso); } csere(tomb, felso, bal); gyors(tomb, bal, felso -1); gyors(tomb, felso+1, jobb); } } static void csere(int[] tomb, int i, int j) { int seged = tomb[i]; tomb[i] = tomb[j]; tomb[j] = seged; } public static void main(String args[]) { int[] tomb = {8, 5, 2, 9, 4, 3, 1, 6}; int meret = 8; gyors(tomb, 0, 7); for(int i=0; i