摘要: Sort a linked list in O(n log n) time using constant space complexity.由于链表的特性,不能快速查找,但是可以快速移动元素,通过归并排序可以实现O(nlogn)复杂度内的排序/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: L... 阅读全文
posted @ 2013-12-04 12:17 懒猫欣 阅读(209) 评论(0) 推荐(0) 编辑