void reorderList(ListNode *head) { if (NULL == head || NULL == head->next) return; ListNode *pMid = findMidPos(head); pMid = reverseList(pMid); head = Merge(head, pMid); }
ListNode* sortList(ListNode* head) { if (!head || head->next == NULL) return head; ListNode *mid = findMidPos(head); ListNode *right_head = mid->next; mid->next = NULL; // divide head = sortList(head); right_head = sortList(right_head); // merge head = merge(head, right_head); return head; }
void reorderList(ListNode *head) { ListNode *pMid = findMidPos(head); pMid = reverseList(pMid); head = Merge(head, pMid); }