/** * struct ListNode { * int val; * struct ListNode *next; * }; */ /** * * @param head ListNode类 the head node * @return ListNode类 */ struct ListNode* sortInList(struct ListNode* head ) { // write code here struct ListNode *p1 ,*p2,*p3; int b; for(p1=head;p1!=NULL;p1=p1->next) for(p2=p1;p2!=NULL;p2=p2->next) {if(p1->val>p2->val){ b=p2->val; p2->val=p1->val; p1->val=b;} } return head; }