摘要:
Given a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For exam... 阅读全文
posted @ 2015-06-17 15:42
朱传林
阅读(191)
评论(0)
推荐(0)
摘要:
Sort a linked list inO(nlogn) time using constant space complexity. 分析:排序算法中,堆排序、归并排序、快速排序、希尔排序的时间复杂度是nlogn,堆排序和归并排序对下标依赖性比较强,比较适合顺序表的排序,对链表处理起来比较... 阅读全文
posted @ 2015-06-17 09:45
朱传林
阅读(158)
评论(0)
推荐(0)
摘要:
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; *... 阅读全文
posted @ 2015-06-17 09:42
朱传林
阅读(127)
评论(0)
推荐(0)

浙公网安备 33010602011771号