the first time use merge sort for list,but i think there is nothing wrong with :) why Time Limit Exceeded?

```
class Solution {
public:
ListNode *mergeList(ListNode *head1,ListNode *head2)
{
ListNode *tmp,*p;
if(!head1) return head2;
if(!head2) return head1;
if(head1->val < head2->val)
tmp = head1,head1 = head1->next;
else
tmp = head2,head2 = head2->next;
p = tmp;
while(head1 && head2)
{
if(head1->val < head2->val)
tmp->next = head1,tmp = tmp->next,head1 = head1->next;
else
tmp->next = head2,tmp = tmp->next,head2 = head2->next;
}
while(head1)
tmp->next = head1,tmp = tmp->next,head1 = head1->next;
while(head2)
tmp->next = head2,tmp = tmp->next,head2 = head2->next;
return p;
}
ListNode *sortList(ListNode *head)
{
if(!head) return NULL;
ListNode *quick,*low,*ans;
ans = quick = low = head;
if(quick->next && quick->next->next)
{
quick = quick->next->next;
low = low->next;
}
if(low->next == NULL) return ans;
quick = low->next;
low->next = NULL;
low = head;
ListNode* l = sortList(low);
ListNode* q = sortList(quick);
ans = mergeList(l,q);
return ans;
}
};
```