码迷,mamicode.com
首页 >  
搜索关键字:linked_list    ( 3784个结果
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 ...
分类:其他好文   时间:2014-06-29 14:39:10    阅读次数:268
Remove Duplicates from Sorted List II
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinctnumbers from the original list.For example,Given1->2->3-...
分类:其他好文   时间:2014-06-04 20:19:49    阅读次数:282
C#数据结构-单链表
理论基础: 链表是用一组任意的存储单元来存储线性表中的数据元素。 如果结点的引用域只存储该结点直接后继结点的存储地址,则该链表叫单链表(Singly Linked List)。单链表由头引用H唯一确定。头引用指向单链表的第一个结点,也就是把单链表第一个结点的地址放在H中。 C#实现: 1接口 引用....
分类:其他好文   时间:2014-05-29 16:36:06    阅读次数:294
LeetCode --- Add Two Numbers
题目链接说来算是个基础题目,可是还是各种CE,各种WA,基础还是不扎实。附上代码: 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *ne...
分类:其他好文   时间:2014-05-28 23:56:38    阅读次数:382
leetcode -- Flatten Binary Tree to Linked List
算法:1. 对root的左子树做处理,让左子树的根节点作为,根节点的右子树,并让右子树作为左子树根节点的右子树的子树2. 递归遍历右子树public void flatten(TreeNode root) { if(root==null){ return; ...
分类:其他好文   时间:2014-05-26 23:39:49    阅读次数:253
[leetcode]Copy List with Random Pointer @ Python
原题地址:https://oj.leetcode.com/problems/copy-list-with-random-pointer/题意:A linked list is given such that each node contains an additional random pointe...
分类:编程语言   时间:2014-05-26 23:16:12    阅读次数:368
[LeetCode] [Partition List 2012-04-30]
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-05-26 09:35:28    阅读次数:266
49. 3种方法实现复杂链表的复制[clone of complex linked list]
clone of complex linked list.
分类:其他好文   时间:2014-05-26 09:34:02    阅读次数:264
LeetCode:Remove Nth Node From End of List
Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked list: 1->2->3->4->5, and n = 2. After rem...
分类:其他好文   时间:2014-05-26 09:08:23    阅读次数:262
leetcode Remove Nth Node From End of List
题目说:Try to do this in one pass 只用一遍遍历的话,p1先走n节点,p2再走,等到p1到达链表尾的时候p2正好在倒数第n+1个上面鸟 /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode...
分类:其他好文   时间:2014-05-23 01:52:29    阅读次数:331
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!