int Xselect(int k) { for (int i=0;i<=k;i++) { int minIndex = i; int minValue = pole[i]; for (int j=i+1;j<=N-1;j++) { if (pole[j] < minValue) { minIndex = j; minValue = pole[j]; } } swap(i,minIndex); } return pole[k]; }