码迷,mamicode.com
首页 >  
搜索关键字:linked_list    ( 3784个结果
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-10-24 14:33:58    阅读次数:154
leetcode:linked_list_cycle_II
给定一个链表,如果链表中有环则返回环的开始节点,否则返回NULL。要求不用额外的空间完成。...
分类:其他好文   时间:2014-10-24 13:01:28    阅读次数:159
LeetCode Remove Nth Node From End of List
Given a linked list, remove thenthnode from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After re...
分类:其他好文   时间:2014-10-24 12:51:42    阅读次数:155
判断链表是否有环
Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra space? 关键点:1)判断链表是否有环。 2)一个小坑在判断root和root的next是否为空上。 3)可以看为追及问题。最关键的坑在判断快走(每次走2步的节点),走1步会...
分类:其他好文   时间:2014-10-23 00:03:10    阅读次数:276
[002] delete_duplication_of_linked_list
[Description] Given a unsort linked list, delete all the duplication from them, no temporary space permission.[Thought] Set two points, from head to t...
分类:其他好文   时间:2014-10-22 17:17:58    阅读次数:120
LeetCode 148 Sort List
Sort a linked list in O(n log n) time using constant space complexity. 思路:要想时间复杂度达到O(n log n) ,那么有两种,一种是合并排序,另一种是快速排序,而要想空间复杂度为常数,那么只能使用递归,本人使用的是递归的合并排序,代码如下: /** * Definition for s...
分类:其他好文   时间:2014-10-22 12:55:55    阅读次数:200
Reverse Nodes in k-Group
[leetcode]Given a linked list, reverse the nodes of a linked list k at a time and return its modified list....
分类:其他好文   时间:2014-10-22 11:04:19    阅读次数:202
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?注意,链表循环并不是尾指针和头指针相同,可能是在中间某一段形成一个环路,所以不能只判...
分类:其他好文   时间:2014-10-21 22:56:24    阅读次数:335
LeetCode--Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2, return1->2.Given1->1->2->3->3, retu...
分类:其他好文   时间:2014-10-21 11:42:57    阅读次数:165
[Leetcode] Remove Nth Node From End of List
Given a linked list, remove thenthnode from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After re...
分类:其他好文   时间:2014-10-21 03:34:24    阅读次数:197
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!