码迷,mamicode.com
首页 >  
搜索关键字:linked_list    ( 3784个结果
leetcode------Linked List Cycle(3)
标题:Linked List Cycle通过率:36%难度中等Given a linked list, determine if it has a cycle in it.Follow up: Can you solve it without using extra space?拿到题后我以为很简单...
分类:其他好文   时间:2014-12-11 17:09:01    阅读次数:167
Sort List leetcode
实现单链表排序   时间复杂度要求为   nlogn    由于是单链表,用快速排序无法往前面遍历(双向链表可以考虑),这里我们用到归并排序 代码如下: /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(in...
分类:其他好文   时间:2014-12-10 22:52:35    阅读次数:258
【LeetCode】Swap Nodes in Pairs
题目 Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you should return the list as 2->1->4->3. Your algorithm should use only constant ...
分类:其他好文   时间:2014-12-10 16:26:18    阅读次数:123
【LeetCode】Linked List Cycle II
题目 Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Follow up: Can you solve it without using extra space? 解答 利用快慢指针使用Linked List Cycle I的办法,判...
分类:其他好文   时间:2014-12-10 16:19:41    阅读次数:187
【Zhejiang University PATest】02-1. Reversing Linked List
Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For example, given L being 1→2→3→4→5→6,...
分类:其他好文   时间:2014-12-09 21:19:43    阅读次数:309
LeetCode之Sort List
1.问题描述 Sort a linked list in O(n log n) time using constant space complexity.2.翻译 在固定的空间复杂度中使用O(nlog n)的时间复杂度进行链表的排序。 3.思路分析 提起排序,我们脑海中会迅速出现各种排序算法...
分类:其他好文   时间:2014-12-09 21:06:36    阅读次数:181
【LeetCode】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->3->3->4->4->5, return 1->2->5. Giv...
分类:其他好文   时间:2014-12-09 17:50:05    阅读次数:142
【原创】leetCodeOj --- Sort List 解题报告
今日leetcode链表题全制霸原题地址:https://oj.leetcode.com/problems/sort-list/题目内容:Sort ListSort a linked list inO(nlogn) time using constant space complexity.方法:题目...
分类:其他好文   时间:2014-12-09 17:19:38    阅读次数:162
【LeetCode】Reorder List
题目 Given a singly linked list L: 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 example, Given {1,2,3,4}, reorde...
分类:其他好文   时间:2014-12-09 15:41:35    阅读次数:150
【LeetCode】Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear only once....
分类:其他好文   时间:2014-12-09 00:36:43    阅读次数:202
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!