using insertion sort logic. Insert each new node into a sorted linked list with dummy head.

```
public class Solution {
public ListNode insertionSortList(ListNode head) {
ListNode sortedHeadDummy = new ListNode(0);
ListNode curr = head;
while (curr != null) {
ListNode next = curr.next;
insert(sortedHeadDummy, curr);
curr = next;
}
return sortedHeadDummy.next;
}
private void insert(ListNode dummyHead, ListNode target) {
// left to right scan to insert the target node
ListNode curr = dummyHead;
while (curr.next != null && curr.next.val < target.val) {
curr = curr.next;
}
target.next = curr.next;
curr.next = target;
}
}
```