public ListNode sortList(ListNode head) {
        if (head == null || head.next == null)
            return head;
        ListNode mid = getMid(head);
        ListNode rightNode = mid.next;
        mid.next = null;
        ListNode left = sortList(head);
        ListNode right = sortList(rightNode);
        return merge(left, right);
    }