码迷,mamicode.com
首页 >  
搜索关键字:linked_list    ( 3784个结果
我要好offer之 链表大总结
单链表是一种递归结构,可以将单链表看作特殊的二叉树(我把它叫做一叉树)单链表的定义:/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * List...
分类:其他好文   时间:2014-08-13 18:37:17    阅读次数:213
leetcode 刷题之路 82 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 original relative order of the nodes in each of...
分类:其他好文   时间:2014-08-13 15:02:26    阅读次数:208
[LeetCode] Reverse Linked List II
Reverse a linked list from position m to n. Do it in-place and in one-pass.For example: Given 1->2->3->4->5->NULL, m = 2 and n = 4,return 1->4->3->2->...
分类:其他好文   时间:2014-08-13 00:50:34    阅读次数:247
Copy List with Random Pointer
A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy ...
分类:其他好文   时间:2014-08-12 16:49:54    阅读次数:205
LeetCode:Sort List
Problem:       Sort a linked list in O(n log n) time using constant space complexity. 解题思路:     首先,时间复杂度能达到O(nlgn)的排序算法,常见的有3种:堆排序、归并排序和快速排序, 而对于链表,用堆排序显然不太可能,所以,我们可用归并或者是快排.由于合并...
分类:其他好文   时间:2014-08-12 00:45:13    阅读次数:217
pat解题报告【1074】
1074. Reversing Linked List (25) 时间限制   300 ms 内存限制   32000 kB 代码长度限制   16000 B 判题程序     Standard     作者     CHEN, Yue Given a constant K and a singly li...
分类:其他好文   时间:2014-08-11 21:30:32    阅读次数:222
leetcode -- Copy List with Random Pointer
你以为那是你的极限,也许只是别人的起点[问题描述]A linked list is given such that each node contains an additional random pointer which could point to any node in the list or...
分类:其他好文   时间:2014-08-11 21:15:12    阅读次数:182
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?思路...
分类:其他好文   时间:2014-08-11 20:48:22    阅读次数:220
Linked List Cycle
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?思路:使用两个指针slow和fast,分别以1和2的速度遍历链表。若链表中存在环,则...
分类:其他好文   时间:2014-08-11 20:45:12    阅读次数:230
leetcode 刷题之路 76 Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear only once. For example, Given 1->1->2, return 1->2. Given 1->1->2->3->3, return 1->2->3. 删除排序链表中重复的节点,删除操作...
分类:其他好文   时间:2014-08-11 18:01:22    阅读次数:243
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!