2016年5月30日

Remove Duplicates from Sorted List II

摘要: Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. For example,Given 1->2 阅读全文

posted @ 2016-05-30 22:07 Sheryl Wang 阅读(168) 评论(0) 推荐(0) 编辑

Partition List

摘要: Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the 阅读全文

posted @ 2016-05-30 20:12 Sheryl Wang 阅读(123) 评论(0) 推荐(0) 编辑

Linked List Cycle II

摘要: Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Note: Do not modify the linked list. Follow up:Can you 阅读全文

posted @ 2016-05-30 16:32 Sheryl Wang 阅读(116) 评论(0) 推荐(0) 编辑

Sort List

摘要: Sort a linked list in O(n log n) time using constant space complexity. 题目要求用 O(n log n)的时间复杂度和常数的空间复杂度来进行链表排序。 O(nlogn)的排序算法有堆排,快排,归并排序等,一开始我准备采用快排,后来 阅读全文

posted @ 2016-05-30 15:40 Sheryl Wang 阅读(166) 评论(0) 推荐(0) 编辑

导航