码迷,mamicode.com
首页 >  
搜索关键字:linked_list    ( 3784个结果
[leetcode]Remove Nth Node From End of List
Remove Nth Node From End of ListGiven a linked list, remove thenthnode from the end of list and return its head.For example, Given linked list: 1->2.....
分类:其他好文   时间:2014-07-22 22:53:35    阅读次数:220
[leetcode]Insertion Sort List
Insertion Sort ListSort a linked list using insertion sort.算法思路:最基本的插入排序,时间复杂度O(n*n),空间复杂度O(1)代码: 1 public class Solution { 2 public ListNode inse...
分类:其他好文   时间:2014-07-22 00:23:34    阅读次数:204
[leetcode]Remove Duplicates from Sorted List
Remove Duplicates from Sorted ListGiven a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2, r...
分类:其他好文   时间:2014-07-21 09:38:07    阅读次数:199
[leetcode]Remove Duplicates from Sorted List II
Remove Duplicates from Sorted List IIGiven a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinctnumbers from the or...
分类:其他好文   时间:2014-07-21 09:33:03    阅读次数:218
LeetCode:Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2, return1->2.Given1->1->2->3->3, retu...
分类:其他好文   时间:2014-07-21 09:08:29    阅读次数:209
【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-07-21 09:02:01    阅读次数:161
[leetcode]Partition List
Partition ListGiven a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should pres...
分类:其他好文   时间:2014-07-21 08:28:54    阅读次数:230
C++ Binary Tree Traversal
关于二叉树的遍历有很多的方法, 下面介绍两个经典的遍历算法: BFS和DFS。一个是深度优先遍历, 一个是广度有优先遍历。 这两种遍历算法均属于盲目的遍历算法, 一般而言, 启发式的遍历搜索算法比较好一些。 。 关于各种遍历算法的对比, 将会在后面逐一提及。 这里不在赘述。 由于树是一个非线性的数据结构, 显然不能像linked list , 或者Array那样通过从头像最末尾移动去实现遍历每一...
分类:编程语言   时间:2014-07-20 23:14:21    阅读次数:387
LeetCode——Remove Nth Node From End of List
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. After removing the second node from the end, the...
分类:其他好文   时间:2014-07-20 15:27:41    阅读次数:216
[leetcode]Swap Nodes in Pairs
Swap Nodes in PairsGiven a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2-...
分类:其他好文   时间:2014-07-19 22:25:10    阅读次数:210
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!