码迷,mamicode.com
首页 >  
搜索关键字:linked    ( 5490个结果
Problem Linked List Cycle II
Problem Description:Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without u...
分类:其他好文   时间:2014-07-07 17:00:35    阅读次数:161
Problem Insertion Sort List
Problem Description:Sort a linked list using insertion sort.Solution: 1 public class Solution { 2 public ListNode insertionSortList(ListNode head)...
分类:其他好文   时间:2014-07-07 16:57:55    阅读次数:117
Problem Sort List
Problem Description:Sort a linked list inO(nlogn) time using constant space complexity.Solution: 1 public ListNode sortList(ListNode head) { 2 ...
分类:其他好文   时间:2014-07-07 16:48:00    阅读次数:238
Problem Reorder List
Problem Description:Given 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 no...
分类:其他好文   时间:2014-07-07 16:41:56    阅读次数:141
Problem Copy List with Random Pointer
Problem Description: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...
分类:其他好文   时间:2014-07-07 16:19:01    阅读次数:188
LeetCode: Reorder List [143]
【题目】 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 it to {1,4,2,3}. 【题意】 给定一个链表L: L0→L1→…→Ln-1→Ln,对他重新排序成L...
分类:其他好文   时间:2014-06-30 10:11:14    阅读次数:158
LeetCode: Linked List Cycle II [142]
【题目】 Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Follow up: Can you solve it without using extra space? 【题意】 给定一个单向链表,如果链表有环,则返回环开始的位置。 【思路】 仍然是维护两个指针, p1, p2, p1每次走一步, p2每次走两步 ...
分类:其他好文   时间:2014-06-29 23:59:21    阅读次数:354
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每次向前移动一步,p2每次向前移动两步 如果p2能够追上p1,则说明链表中存在环...
分类:其他好文   时间:2014-06-29 22:51:33    阅读次数:267
LeetCode: Copy List with Random Pointer [138]
【题目】 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. 【题意】 给定一个链表,每个节点除了next指针外,还有一个random指针,指向任意的节点。 要求,复制这样的一个链表 【思路】 思路...
分类:其他好文   时间:2014-06-29 20:41:21    阅读次数:232
常用数据结构及复杂度
本文将介绍一些常用数据结构,包括 Array, Linked List, List, HashTable, Stack, Queue 等。并同时介绍关于这些基本数据结构的常用操作的复杂度以及如何选择使用合适的数据结构。
分类:其他好文   时间:2014-06-29 20:26:01    阅读次数:406
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!