摘要:
Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull. Follow up:Can you solve it without using extra space? 题 阅读全文
摘要:
Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using extra space? 判断链表中是否有环,不能用额外的空间,可以使用快慢指针,慢指针一次走一步,快指针 阅读全文
摘要:
Given a singly linked list L: L 0→L 1→…→L n-1→L n,reorder it to: L 0→L n →L 1→L n-1→L 2→L n-2→… You must do this in-place without altering the nodes' 阅读全文
摘要:
Sort a linked list in O(n log n) time using constant space complexity. 时间复杂度为O(nlogn),可以想到归并排序、快排、桶排序。 思路:使用归并排序,整体可以分为两体,一、构造两个已排序的子链表;二、将子链表合并。针对第一部 阅读全文