[CODE]#include<cstdio>
void Swap(int *a, int *b)
{
int tmp = *a;
*a = *b;
*b = tmp;
}
void sort(int a[], int size)
{
int lower = 0, upper = size;
while( lower <= upper)
{
while(lower<upper && a[lower]%2==1)
lower++;
while(lower<upper && a[upper]%2==0)
upper--;
if(lower < upper)
Swap(&a[lower++], &a[upper--]);
else
lower++;
}
}
int main()
{
int a[10]={2,1,3,9,7,8,6,3,4,0};
sort(a,10);
for(int i=0;i<10;i++)
printf("%d ",a[i]);
}[/CODE]
这个复杂度是多少,三个while