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; } } }
|
文章评论(0条评论)
登录后参与讨论