Merge sort a linked list

Question: Sort a linked list in ascending order using merge sort
Answer: Dive and Conquer technique can be used to achieve this.
Get the count of the list. Break the list into two equal parts, sort each individual list them merge.
Time complexity: Avg: O(NlogN) Worst: O(N^2)
Space complexity: No extra space required

Solution can be found here

Leave a Reply

Your email address will not be published. Required fields are marked *