摘要: 题目:Given a list, rotate the list to the right bykplaces, wherekis non-negative.For example:Given1->2->3->4->5->NULLandk=2,return4->5->1->2->3->NULL.题解... 阅读全文
posted @ 2015-08-27 23:56 Hygeia 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a singly linked list, determine if it is a palindrome. Follow up: Could you do it in O(n) time and O(1) space?碉堡!reference:http://www.cnblogs... 阅读全文
posted @ 2015-08-27 13:48 Hygeia 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 题目:Sort a linked list inO(nlogn) time using constant space complexity.思路:考虑到要求用O(nlogn)的时间复杂度和constant space complexity来sort list,自然而然想到了merge sort方法。... 阅读全文
posted @ 2015-08-27 13:39 Hygeia 阅读(149) 评论(0) 推荐(0) 编辑