码迷,mamicode.com
首页 >  
搜索关键字:linked_list    ( 3784个结果
[Leetcode][JAVA] Insertion Sort List
Sort a linked list using insertion sort.简单插入排序,先写个插入一个值到链表里的函数,再遍历整个链表,一个一个把值插入新链表中: 1 public ListNode insertionSortList(ListNode head) { 2 i...
分类:编程语言   时间:2014-09-19 07:41:55    阅读次数:165
Remove Duplicates from Sorted List II
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.For example,Given 1->2-...
分类:其他好文   时间:2014-09-18 05:24:13    阅读次数:195
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 ...
分类:其他好文   时间:2014-09-18 04:21:33    阅读次数:228
Leetcode: Sort List
Sort a linked list in O(n log n) time using constant space complexity.记得Insert Sort List, 那个复杂度是O(N^2)的,这里要求O(nlogn),所以想到merge sort, 需要用到Merge Two Sor...
分类:其他好文   时间:2014-09-18 01:57:43    阅读次数:199
LeetCode: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-09-17 21:48:42    阅读次数:302
Leetcode: Insertion Sort List
Sort a linked list using insertion sort.难度:84. 我自己的做法是使用了额外的空间,建立了一个新的sorted的LinkedList, 技巧还是建立一个dummy node做前置节点。 1 /** 2 * Definition for singly-lin....
分类:其他好文   时间:2014-09-17 13:30:42    阅读次数:264
访问文档中的所有元素
DOM Example Heading Paragraph Subheading List 1 List 2 Linked List Item List 4 Paragraph Paragraph ...
分类:其他好文   时间:2014-09-17 11:51:12    阅读次数:218
LeetCode:Remove Nth Node From End of List
Given a linked list, remove thenthnode from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After re...
分类:其他好文   时间:2014-09-16 14:13:50    阅读次数:133
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-16 13:57:50    阅读次数:163
Remove Nth Node From End of List
Given a linked list, remove thenthnode from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After re...
分类:其他好文   时间:2014-09-16 10:24:40    阅读次数:158
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!