码迷,mamicode.com
首页 >  
搜索关键字:linked_list    ( 3784个结果
Partition List
Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the origi...
分类:其他好文   时间:2014-11-18 23:45:02    阅读次数:222
leetcode --- Linked List Cycle [Floyd's cycle-finding algorithm]
Linked List CycleGiven a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?Linked ListTwo Pointers''...
分类:其他好文   时间:2014-11-18 23:25:09    阅读次数:170
LeetCode Solutions : Sort List
【算法思路】时间复杂度限制在O(n log n),我们可以第一时间想到常用的二路归并排序,快速排序和堆排序,其中快排和堆排只适用于线性表,即数组,故这道编程题毫无疑问用二路归并排序; 【编程步骤】 * 1. 利用一个小技巧,可以设置慢行指针low和快行指针fast,把链表分成两部分来操作,即first和second链表 * 2. 递归排序first和second链表,即 first=sortList(head); second=sortList(second); * 3. 合并这两个链表,即:...
分类:其他好文   时间:2014-11-18 10:23:15    阅读次数:185
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 removing the second node from t...
分类:其他好文   时间:2014-11-18 10:18:38    阅读次数:170
[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-11-18 06:58:19    阅读次数:145
[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-11-18 06:52:58    阅读次数:226
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-11-18 00:18:35    阅读次数:182
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-11-18 00:05:29    阅读次数:287
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-11-17 22:45:53    阅读次数:164
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-11-17 14:01:44    阅读次数:173
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!