码迷,mamicode.com
首页 >  
搜索关键字:linked    ( 5490个结果
leetcode第一刷_Linked List Cycle II
这道题稍微有点意思,知道答案发现,呀,这么简单就能做啊。我一开始想的是,相遇之后用另一个指针怎么走,然后满足什么关系之后能推出来,其实不用这么麻烦。是很简单的数学关系,我画个图说一下。 S1代表的是链表进入环之前的长度,a代表当两个指针相遇时,走一步的指针在环里走的长度,S2代表的是环的周长,那么根据条件,相遇时,走两步的指针走的距离是走一步的两倍,我们得到公式: (S1+a)*2 =...
分类:其他好文   时间:2014-05-10 10:29:57    阅读次数:364
PAT 1074. Reversing Linked List (25)
PAT 1074. Reversing Linked List (25)
分类:其他好文   时间:2014-05-09 12:46:25    阅读次数:316
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-05-09 12:00:21    阅读次数:309
leetcode -day8 Copy List with Random Pointer & Single Number I II
五一中间断了几天,开始继续。。。 1、 ?? 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...
分类:其他好文   时间:2014-05-06 18:54:59    阅读次数:386
Leetcode | Merge k Sorted Lists
Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.想法很简单,就是两两合并。在Merge Two Sorted Lists这道题已经实现了两两合并的代码了,就...
分类:其他好文   时间:2014-05-06 00:22:01    阅读次数:337
Reverse Nodes in k-Group
Link:http://oj.leetcode.com/problems/reverse-nodes-in-k-group/Given a linked list, reverse the nodes of a linked listkat a time and return its modifie...
分类:其他好文   时间:2014-05-05 22:46:42    阅读次数:456
Reverse Linked List II
Link:http://oj.leetcode.com/problems/reverse-linked-list-ii/Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1...
分类:其他好文   时间:2014-05-05 22:46:11    阅读次数:411
Swap Nodes in Pairs
Link:http://oj.leetcode.com/problems/swap-nodes-in-pairs/Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2-...
分类:其他好文   时间:2014-05-05 22:45:37    阅读次数:331
Insertion Sort List
Sort a linked list using insertion sort.思路:使用插入排序来对链表进行排序。只要注意链表的边界问题,其实关键就是交换链表的值,对链表指针是没有什么影响的。接下来说下具体步骤:1.判断head或者head->next是否为空;2.循环遍历,初始条件pCur=he...
分类:其他好文   时间:2014-05-04 10:01:57    阅读次数:242
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-02 09:10:46    阅读次数:252
5490条   上一页 1 ... 545 546 547 548 549 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!