码迷,mamicode.com
首页 >  
搜索关键字:linked    ( 5490个结果
reverse a linked-list(C++)
#includeusing namespace std;class Node{public: Node(int value) : value(value), next(NULL) {}public: int value; Node* next;};Node* reverseList...
分类:编程语言   时间:2014-06-27 20:02:00    阅读次数:253
leetcode - Linked List Cycle
题目:Linked List CycleGiven a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?个人思路:1、判断一个链表是否有环,标准做法...
分类:其他好文   时间:2014-06-27 19:41:40    阅读次数:165
[leetcode] Reverse Nodes in k-Group
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.
分类:其他好文   时间:2014-06-27 12:48:46    阅读次数:259
[leetcode] Swap Nodes in Pairs
Given a linked list, swap every two adjacent nodes and return its head.
分类:其他好文   时间:2014-06-27 12:42:55    阅读次数:198
Sort List
Sort a linked list in O(n log n) time using constant space complexity.思路:使用O(nlogn)时间复杂度和常数空间复杂度,我们想到可以用归并排序。1)找到链表中间位置2)将两个链表按序合并链表3)对所给链表进行整体的归并排序/*...
分类:其他好文   时间:2014-06-27 00:22:37    阅读次数:303
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->5...
分类:其他好文   时间:2014-06-26 23:07:29    阅读次数:276
Reorder List
Given a singly linked listL: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 exam...
分类:其他好文   时间:2014-06-26 23:04:14    阅读次数:221
Leetcode: 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 o...
分类:其他好文   时间:2014-06-25 12:14:23    阅读次数:159
leetcode--Reverse Nodes in k-Group
Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a multiple ofkthen left-o...
分类:其他好文   时间:2014-06-25 11:10:16    阅读次数:163
Add Two Numbers
题目 You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return...
分类:其他好文   时间:2014-06-24 21:46:24    阅读次数:249
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!