public static ListNode insertionSortList(ListNode head) {
        if (head == null || head.next == null) {
            return head;
        }

        ListNode first = new ListNode(Integer.MIN_VALUE);
        first.next = head;

        ListNode cur, tmp, post, pre;
        cur = head.next;

        while (cur != null) {
            pre = first;
            tmp = first.next;
            post = cur.next;
            while (tmp != cur && tmp.val <= cur.val) {
                pre = tmp;
                tmp = tmp.next;
            }
            if (tmp != cur) {
                pre.next = cur;
                cur.next = tmp;
                
                while (tmp.next != cur) {
                    tmp = tmp.next;
                }
                tmp.next = post;
            }

            cur = post;
        }

        return first.next;
    }