码迷,mamicode.com
首页 >  
搜索关键字:linked    ( 5490个结果
LeetCode:Reverse Nodes in k-Group
题目链接 Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k t...
分类:其他好文   时间:2014-06-28 21:12:46    阅读次数:211
LeetCode解题报告:Reorder List
Reorder ListGiven a singly linked listL: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' val...
分类:其他好文   时间:2014-06-28 20:42:16    阅读次数:265
Leetcode Insertion Sort List
Sort a linked list using insertion sort.单链表的插入排序, 考查的时单链表指针的断开和插入操作#include #include #include using namespace std;struct ListNode{ int val; List...
分类:其他好文   时间:2014-06-21 12:26:49    阅读次数:206
Leetcode SortList
Sort a linked list inO(nlogn) time using constant space complexity.本题利用归并排序即可归并排序的核心是将两部分合成一部分,故开始要将链表分成两部分,利用快慢两个指针,当快指针跑到链表尾部时,慢指针恰好在中间,故可以将链表分成两部分然...
分类:其他好文   时间:2014-06-21 12:20:11    阅读次数:188
[LeetCode] Merge Two Sorted Lists
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists./** * Def...
分类:其他好文   时间:2014-06-21 07:55:42    阅读次数:197
[LeetCode] Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear only once.For example, Given 1->1->2, return 1->2. Given 1->1->2->3->3...
分类:其他好文   时间:2014-06-21 07:30:11    阅读次数:157
Swap Nodes in Pairs
题目 Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you should return the list as 2->1->4->3. Your algorithm should use only const...
分类:其他好文   时间:2014-06-18 11:53:39    阅读次数:138
[leetcode] 2. 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 ...
分类:其他好文   时间:2014-06-17 23:38:04    阅读次数:341
Reverse Nodes in k-Group
题目 Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k then left-out nodes in the end should rem...
分类:其他好文   时间:2014-06-17 22:15:52    阅读次数:299
Merge k Sorted Lists
题目 Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 方法 使用归并排序的思想,两两合并,直到最终变成一个。 public ListNode mergeKLists(ArrayList lists) {...
分类:其他好文   时间:2014-06-17 21:34:41    阅读次数:183
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!