码迷,mamicode.com
首页 >  
搜索关键字:linked    ( 5490个结果
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
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
31.从尾到头输出链表
Print a linked list from last to first.
分类:其他好文   时间:2014-05-22 00:06:27    阅读次数:258
33.在O(1)时间删除链表结点
Delete node in linked list in O(1).
分类:其他好文   时间:2014-05-22 00:05:51    阅读次数:190
【Leetcode】Reverse Linked List II
Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->NULL,m= 2 andn= 4,return1->4->3->2->5->NULL.No...
分类:其他好文   时间:2014-05-21 19:08:08    阅读次数:195
【Leetcode】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-05-21 17:51:09    阅读次数:190
leetcode -day20 Add Two Numbers
1、 ?? 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 num...
分类:其他好文   时间:2014-05-21 10:49:10    阅读次数:221
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->NULL. Note: Given m, n satisfy the fol...
分类:其他好文   时间:2014-05-21 07:18:02    阅读次数:301
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!