int select_(int left,int right,int k) { while(1) { int count; int pivotIndex = (left + right) / 2; int pivotNewIndex = partition(left, right, pivotIndex, &count); if (k == pivotNewIndex) return pole[k]; else if (k < pivotNewIndex) right = pivotNewIndex-1; else left = pivotNewIndex+1; } }