C++ | In-Place Insertion Sort
I sorted the given list in-place since the problem didn\'t specify producing a new list.\n```\n    ListNode insertionSortList(ListNode head) {\n        \n      
I sorted the given list in-place since the problem didn\'t specify producing a new list.\n```\n    ListNode* insertionSortList(ListNode* head) {\n        \n        /* Base case */\n        if (head == nullptr) return nullptr; \n        \n        /* Perform in-place insertion sort. */\n        /* Time - O(n^2); Space - O(1) */\n        int temp = 0;\n        for (ListNode* node = head; node != nullptr; node = node->next) {            \n            for (ListNode* comp = head; comp != node; comp = comp->next) {\n                /* If the current value is less than a previous value, */\n                /* then swap the values. */\n                if (node->val < comp->val) {\n                    temp = node->val;\n                    node->val = comp->val;\n                    comp->val = temp;\n                }\n            }\n        }\n\n        return head;\n    }
['C']