码迷,mamicode.com
首页 >  
搜索关键字:constant    ( 1663个结果
LeetCode--Sort List
Sort a linked list in O(n log n) time using constant space complexity. MergeSort对于链表的排序,实现了就地排序的同时,时间复杂度和空间复杂度都达到了基于比较的排序的最优值,因此归并排序是链表排序的最佳排序方式。 /** * Definition for singly-linked list. * str...
分类:其他好文   时间:2015-01-15 16:01:52    阅读次数:193
LeetCode--Populating Next Right Pointers in Each Node II
Follow up for problem "Populating Next Right Pointers in Each Node". What if the given tree could be any binary tree? Would your previous solution still work? Note: You may only use constant ...
分类:其他好文   时间:2015-01-14 17:55:09    阅读次数:199
Sort List
Sort a linked list in O(n log n) time using constant space complexity. #include #include typedef struct ListNode{ int val; struct ListNode *next; }ListNode; ListNode *mergesort(ListNode *...
分类:其他好文   时间:2015-01-13 17:42:46    阅读次数:113
[LeetCode]148.Merge Two Sorted Lists
【题目】 Sort a linked list in O(n log n) time using constant space complexity. 【分析】 单链表适合用归并排序,双向链表适合用快速排序。本题可以复用Merge Two Sorted Lists方法 【代码】 /********************************* * 日期:2015-01-1...
分类:其他好文   时间:2015-01-13 00:10:40    阅读次数:184
struts中的常量
之前在使用struts的时候是使用MyEclipse,所以有很多东西是不需要自己配置的,也就没有注意那么多,现在使用Eclipse,发现有很多东西既熟悉又陌生。对于constant标签,我似乎没有怎么使用,最主要就是使用<constantname="struts.i18n.reload"value="true"/>,现在就全面..
分类:其他好文   时间:2015-01-12 19:34:07    阅读次数:167
Ants
AntsDescriptionAn army of ants walk on a horizontal pole of length l cm, each with a constant speed of 1 cm/s. When a walking ant reaches an end of th...
分类:其他好文   时间:2015-01-10 17:55:32    阅读次数:149
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...
分类:其他好文   时间:2015-01-10 13:57:24    阅读次数:119
leetcode 【 Sort List 】 python 实现
题目:Sort a linked list inO(nlogn) time using constant space complexity.代码:oj 测试通过Runtime:372 ms 1 # Definition for singly-linked list. 2 # class ListNo...
分类:编程语言   时间:2015-01-08 19:37:40    阅读次数:195
[LeetCode] Min Stack
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes...
分类:其他好文   时间:2015-01-08 12:51:24    阅读次数:114
leetcode 155. Min Stack
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes...
分类:其他好文   时间:2015-01-07 23:21:50    阅读次数:181
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!