帮我看看单链表冒泡排序的程序是否正确
单链表,冒泡法升序排列(此种做法是否得当):void sort(node *h)
{ node *p,*q,*l;
int t;
p=h->next;
while(p->next!=NULL)
p=p->next;
l=p;
p=h->next;
while(p!=l) {
while(p!=l) {
if(p->data>p->next->data {
t=p->data;
p->data=p->next->data;
p->next->data=t;
}
q=p;p=p->next;
}
l=q;p=h->next;
}
}