码迷,mamicode.com
首页 >  
搜索关键字:linked_list    ( 3784个结果
LeetCode——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 constant space. Y...
分类:其他好文   时间:2014-07-28 00:28:19    阅读次数:273
Sort List leetcode java
题目:Sort a linked list in O(n log n) time using constant space complexity.题解:考虑到要求用O(nlogn)的时间复杂度和constant space complexity来sort list,自然而然想到了merge sor....
分类:编程语言   时间:2014-07-26 09:51:57    阅读次数:307
Reorder List leetcode java
题目: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.F....
分类:编程语言   时间:2014-07-26 09:51:47    阅读次数:215
Merge k Sorted Lists leetcode java
题目:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.题解:Merge k sorted linked list就是merge 2 sorted li....
分类:编程语言   时间:2014-07-26 05:44:37    阅读次数:304
【LeetCode】【Python】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-07-25 11:09:21    阅读次数:206
Copy List with Random Pointer leetcode java
题目: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 deep c....
分类:编程语言   时间:2014-07-24 10:00:33    阅读次数:310
Flatten Binary Tree to Linked List leetcode java
题目:Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flatten...
分类:编程语言   时间:2014-07-24 09:55:43    阅读次数:211
Reverse Linked List II leetcode java
题目:Reverse a linked list from position m to n. Do it in-place and in one-pass.For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4,return 1->4->3->....
分类:编程语言   时间:2014-07-24 09:49:43    阅读次数:204
Partition List leetcode java
题目:Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve t....
分类:编程语言   时间:2014-07-23 12:27:46    阅读次数:290
Remove Nth Node From End of List leetcode java
题目: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. Af...
分类:编程语言   时间:2014-07-23 12:20:26    阅读次数:243
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!