Java Solution With Detailed Explaination
Explaination\n\n\t\thead : 1 -> 2 -> 4 -> 3 ->null\n\t\t\n\t\tdummyHead : (0)-> 1 -> 2 -> 4 ->3 -> null\n\t\t\n\t\t1 -> 2 -> 4 -> 3 -> null\n\t\t\t |    |\n\t\t
**Explaination**\n```\n\t\thead : 1 -> 2 -> 4 -> 3 ->null\n\t\t\n\t\tdummyHead : (0)-> 1 -> 2 -> 4 ->3 -> null\n\t\t\n\t\t1 -> 2 -> 4 -> 3 -> null\n\t\t\t |    |\n\t\t   head  (head.val <= head.next.val)  => continue\n\t\t  \n\t\t\t\t\t   head\n\t\t\t\t\t \t |\n\t\t(0) -> 1 -> 2 -> 4 -> 3 -> null\n\t\t\t\t    |         |\n\t\t\t    preNode    insertNode\n\t\tFind preNode by checking it value with insertNode\n\t\tConnect next of head to next of insertNode \n\t\t\n\t\t(0) -> 1 -> 2 -> 4 -> null   (connect head to next of insertion node to break the node from the list and to add it in correct position)\n\t\t\n\t\t\n\t\t(0) -> 1 -> 2  -> 4  -> null  (connect next of insertion node to to pre node )\n\t\t\t\t\t|\n\t\t\t\t\t3\n\t\t\t\t\t\n\t\t(0) -> 1 -> 2 -> 3 -> 4 -> null  (finally connect the next of pre node to add the insertion node into list)\n```\n\n**Code**\n```\npublic ListNode insertionSortList(ListNode head) {\n        //base case \n        ListNode dummyHead = new ListNode(0);\n        dummyHead.next = head; \n        ListNode preNode = dummyHead;\n        ListNode insertNode = dummyHead;\n        while(head != null && head.next != null){\n            if(head.val <= head.next.val){\n                //in ascending order , no need to change\n                head = head.next;\n            }\n            else{\n                //move the prenode to the start of the dummyhead\n                preNode = dummyHead;\n                //the node to insert in its correct position is the node next to the actual head\n                insertNode = head.next;\n                //find the pos to insert the current node (insertNode) by checking if pre node values are less than the value of the node to be inserted\n                while(preNode.next.val < insertNode.val){\n                    preNode = preNode.next;\n                }\n                //now next of the pre node is the place where the cuurent node (insertNode) to be inserted\n                //connect the original head to next of insertion node to break the node from the list and to add it in correct position\n                head.next = insertNode.next;\n                //connect next of insertion node to to pre node \n                insertNode.next = preNode.next;\n                //finally connect the next of pre node to add the insertion node into list\n                preNode.next = insertNode;\n            }\n        }\n        return dummyHead.next;\n    }\n```
['Java']