Sort a linked list in O(n log n) time using constant space complexity.
Example 1:
1 | Input: 4->2->1->3 |
Example 2:
1 | Input: -1->5->3->4->0 |
解法1:快速排序
1 | class Solution { |
解法2:归并排序
1 |
参考文献
[1]快速排序:https://blog.csdn.net/u012658346/article/details/51141288
Sort a linked list in O(n log n) time using constant space complexity.
Example 1:
1 | Input: 4->2->1->3 |
Example 2:
1 | Input: -1->5->3->4->0 |
1 | class Solution { |
1 |
[1]快速排序:https://blog.csdn.net/u012658346/article/details/51141288