| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
自己写的快排超时了,用系统的倒过了 173ms 为什么????太郁闷了怎么回事?
下面是我写的快排
int one(struct s a[],int s,int e)
{
struct s t,x=a[e];
int i=s-1;
int j;
for(j=s;j<e;j++)
{
if(a[j].a<=x.a)
{
i++;
t=a[j];
a[j]=a[i];
a[i]=t;
}
}
t=a[i+1];
a[i+1]=a[e];
a[e]=t;
return i+1;
}
void qsort(struct s a[],int s,int e)
{
int q;
if(s<e)
{
q=one(a,s,e);
qsort(a,q+1,e);
qsort(a,s,q-1);
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator