码迷,mamicode.com
首页 >  
搜索关键字:linked_list    ( 3784个结果
Reorder List
leetcode:Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…...
分类:其他好文   时间:2014-09-30 15:13:19    阅读次数:123
LeetCode 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-09-29 23:36:31    阅读次数:258
【Leetcode】Sort List JAVA实现
Sort a linked list inO(nlogn) time using constant space complexity.1、分析该题主要考查了链接上的合并排序算法。2、正确代码实现package com.edu.leetcode;import com.edu.leetcode.List...
分类:编程语言   时间:2014-09-29 03:09:07    阅读次数:315
[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-09-29 01:40:57    阅读次数:297
LeetCode: Linked List Cycle [141]
【题目】Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?【题意】 推断一个单向链表是否有环【思路】 维护两个指针p1和p2,p1.....
分类:其他好文   时间:2014-09-28 21:16:55    阅读次数:195
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-09-28 14:33:56    阅读次数:178
Sort List
题目描述:Sort a linked list inO(nlogn) time using constant space complexity.解题方案:题目要求的时间复杂度是O(nlogn),常数级空间复杂度。所以这里用了归并排序,归并排序在数组上操作比较方便,但是这里要排序的是链表。我们用到两个...
分类:其他好文   时间:2014-09-27 18:56:10    阅读次数:231
leetcode - Copy List with Random Pointer
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 copy of the list. /** * Definition for singly-l...
分类:其他好文   时间:2014-09-26 15:07:08    阅读次数:181
Leetcode_num11_Remove Duplicates from Sorted List
题目: Given a sorted linked list, delete all duplicates such that each element appear only once. 这道链表的题也比较简单,目标是为了去重,只是需要注意在去重的过程中需要使用while循环,使一个节点的下一个节点必须指向与其不同的节点 上代码咯 # Definition for singly-li...
分类:其他好文   时间:2014-09-25 18:39:57    阅读次数:193
LeetCode Linked List Cycle & Linked List Cycle II题解
LeetCode算法题Linked List Cycle 和Linked List Cycle II 详解...
分类:其他好文   时间:2014-09-25 16:32:09    阅读次数:162
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!