我在很多方面编码,但我无法这样做。任何人都可以帮我解决这个问题吗?
void LinkedList::Sort(){
Node* p = NULL;
Node* q = first;
Node* r = first->next;
while(r!=NULL) {
if(q->data.length() > r->data.length()) {
p = q;
q = r;
p->next = p->next->next;
q->next = p;
r = q->next;
} else {
q = q->next;
r = r->next;
}
q = q->next;
r = r->next;
}
}