148 Sort List

Sort a linked list in O(n log n) time using constant space complexity.

The Idea:

  • Just like regular merge sort, except we have to iterate to the half-way point in the list.

  • Prev is required, as it always follows that iterslow = prev->next;

Last updated

Was this helpful?