Python | Simple Solution With Explanation
\n# Definition for singly-linked list.\n# class ListNode:\n#     def __init__(self, val=0, next=None):\n#         self.val = val\n#         self.next = next\ncl
```\n# Definition for singly-linked list.\n# class ListNode:\n#     def __init__(self, val=0, next=None):\n#         self.val = val\n#         self.next = next\nclass Solution:\n    def insertionSortList(self, head: Optional[ListNode]) -> Optional[ListNode]:\n        currentNode = head\n        previousNode = None\n        while currentNode:\n            if previousNode and previousNode.val > currentNode.val:\n                # Detach the current node.\n                detachedNode = currentNode\n                previousNode.next = currentNode.next\n                currentNode = currentNode.next\n                # Attach the detached node at its correct position.\n\t\t\t\t# Check whether the detatched node needs to be attached at first position. If yes then update the head also.\n                if head.val > detachedNode.val:\n                    detachedNode.next = head\n                    head = detachedNode\n                else:\n\t\t\t\t\t# Traverse the list from start and attach the detached node at its correct position.\n                    tempPreviousNode = head\n                    tempCurrentNode = head.next\n                    while tempCurrentNode and tempCurrentNode.val <= detachedNode.val:\n                        tempPreviousNode = tempCurrentNode\n                        tempCurrentNode = tempCurrentNode.next\n                    tempPreviousNode.next = detachedNode\n                    detachedNode.next = tempCurrentNode                    \n            else:\n                previousNode = currentNode\n                currentNode = currentNode.next\n        return head\n```\n\n***If you liked the above solution then please upvote!***
['Linked List', 'Python']