typedef struct node
{
int data;
struct node *next;
}Node;
void sort(Node *head)
{
Node *p, *q, *r;
int temp;
for(p=head->next;p->next!=NULL;p=p->next)
{
r=p;
for(q=p->next;q!=NULL;q=q->next)
if(q->data <= r->data)
r=q;
if(r!=p)
{
temp=p->data;
p->data=r->data;
r->data=temp;
}
}
}
阅读(1703) | 评论(4) | 转发(0) |