148.Sort List---链表排序(冒泡、归并)
摘要:
题目链接 题目大意:对链表进行排序,要求时间复杂度是o(nlgn)。 法一:冒泡,不交换结点,而交换结点中的数值。超时了。代码如下: 1 public ListNode sortList(ListNode head) { 2 if(head == null || head.next == null) 阅读全文
posted @ 2018-04-02 11:41 二十年后20 阅读(181) 评论(0) 推荐(0)