• 27.7%

https://leetcode.com/problems/sort-list/?tab=Description

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

https://discuss.leetcode.com/topic/17150/clean-and-short-merge-sort-solution-in-c

Clean and short Merge sort Solution in c++

#### cpp

https://discuss.leetcode.com/topic/10382/bottom-to-up-not-recurring-with-o-1-space-complextity-and-o-nlgn-time-complextity

Bottom-to-up(not recurring) with o(1) space complextity and o(nlgn) time complextity

this problem can be easily solved using recurrence and divide-and-conquer. But it consumes program stack to store the recurring function stack frame, actually it consumes o(lgn) space complexity. Recursion use up-to-bottom strategy , why not try the opposite way–bottom-to-up, luckily it works, it only consumes 0(1) space complexity and o(nlgn) time complextity.

https://discuss.leetcode.com/topic/3085/my-o-n-log-n-time-o-1-space-solution

My O(n log n) time, O(1) space solution

Nice problem. I use a non-recurisve way to write merge sort.

For example, the size of ListNode is 8,

Round #1 block_size = 1

(a1, a2), (a3, a4), (a5, a6), (a7, a8)

Compare a1 with a2, a3 with a4 …

Round #2 block_size = 2

(a1, a2, a3, a4), (a5, a6, a7, a8)

merge two sorted arrays (a1, a2) and (a3, a4), then merge tow sorted arrays(a5, a6) and (a7, a8)

Round #3 block_size = 4

(a1, a2, a3, a4, a5, a6, a7, a8)

merge two sorted arrays (a1, a2, a3, a4), and (a5, a6, a7, a8)

No need for round #4 cause block_size = 8 >= n = 8

#### python

https://discuss.leetcode.com/topic/30407/clean-python-code

Clean python code

#### java

https://discuss.leetcode.com/topic/18100/java-merge-sort-solution

Java merge sort solution

https://discuss.leetcode.com/topic/643/i-have-a-pretty-good-mergesort-method-can-anyone-speed-up-the-run-time-or-reduce-the-memory-usage

I have a pretty good MergeSort method. Can anyone speed up the run time or reduce the memory usage?