Sort Linked List Using Insertion Sort
Given the head pointer of a linked list, sort it in ascending order using insertion sort.
We'll cover the following...
Statement
We’re given the head pointer of a linked list. Sort the linked list in ascending order using insertion sort. Return the new head pointer of the sorted linked list.
Example
If the given linked list is 29 -> 23 -> 82 -> 11, then the sorted list should be 11 -> 23 -> 29 -> 82.
Sample input
[29, 23, 82, 11]
Expected output
[11, 23, 29, 82]
Access this course and 1400+ top-rated courses and projects.