rahul_1234's blog

By rahul_1234, history, 9 years ago, In English

I want to sort the numbers using linked list in O(nlogn) time complexity and O(1) space complexity? Plz help me in this.

  • Vote: I like it
  • -14
  • Vote: I do not like it

| Write comment?
»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Use merge sort: If your list is empty or contains single element, it is already sorted, otherwise split it into two equal parts, sort them recursively and merge into single sorted list.