/**

  • 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 *i = head, *j = head->next; int tmp; while(i != NULL) { while(j != NULL) { if((i->val) > (j->val)) { tmp = i->val; i->val = j->val; j->val = tmp; } j = j->next; } i = i->next; j = i->next; } return head; }