码迷,mamicode.com
首页 >  
搜索关键字:linked_list    ( 3784个结果
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-17 13:56:54    阅读次数:182
LeetCode Solutions : Reorder List
Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without altering the nodes' values. For example, Given {1,2,3,4}, reorder itto {1,4,...
分类:其他好文   时间:2014-11-17 10:45:06    阅读次数:179
[Leetcode] Insertion Sort List
Sort a linked list using insertion sort.Solution: 1 /** 2 * Definition for singly-linked list. 3 * public class ListNode { 4 * int val; 5 * ...
分类:其他好文   时间:2014-11-17 09:11:05    阅读次数:218
Singly linked list algorithm implemented by Java
Jeff Lee blog: http://www.cnblogs.com/Alandre/ (泥沙砖瓦浆木匠),retain the url when reproduced ! Thanks Linked list is a normal data structure.here I show ho...
分类:编程语言   时间:2014-11-17 09:10:51    阅读次数:169
Linked List Cycle II
Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra space?本来不...
分类:其他好文   时间:2014-11-16 17:10:02    阅读次数:276
Swap Nodes in Pairs
Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->3.Your algor...
分类:其他好文   时间:2014-11-16 15:57:02    阅读次数:131
Sort List
Sort a linked list inO(nlogn) time using constant space complexity.分析:merge sort。class Solution {public: ListNode *sortList(ListNode *head) { ...
分类:其他好文   时间:2014-11-16 15:51:43    阅读次数:210
Skip List
Skip List | Set 1 (Introduction)Can we search in a sorted linked list in better than O(n) time?The worst case search time for a sorted linked list is ...
分类:其他好文   时间:2014-11-16 15:49:53    阅读次数:173
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-11-16 14:38:00    阅读次数:175
[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-16 13:19:38    阅读次数:160
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!