Saturday, September 20, 2014

Sort List

Problem

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

Idea

Use merge sort ideas to solve. Use two pointer to find the mid position of list. And sort the left and right recursively. Then merge them together.

Solution


No comments:

Post a Comment