typedef struct student {
//......
int keyword;
//......
struct student *next;
}Stu;
void Sort(Stu *head) { // head为有头结点的非循环链表
Stu *p,*s,*pt;
p = head;
s = p->next;
while(p->next != NULL) {
while(s->next != NULL) {
if(p->next->keyword < s->next->keyword) {
pt = p->next;
p->next = s->next;
s->next = p->next->next;
p->next->next = pt;
}
else s = s->next;
}
p = p->next;
s = p->next;
}
}