#define MAXN 100
int a[MAXN],n,k;
int search_c(int a[], int n, int k)
{int low, high, i, j, m, t;
k--,;low=0 ;high=n-1;
do {i=low; j=high ; t=a[low];
do{while (i<j && t<a[j]) j--;
if (i<j) a[i++]=a[j];
while (i<j && t>=a[i]) i++
if (i<j) a[j--]=a[i];
} while (i<j);//一次分割
a[i]=t;
if (1) i==k break ;
if (i<k) low= (2) i+1 ; else high= (3)i-1 ;
}while(4)low<high _;
return(a[k]);
} |
|