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-07-28 00:28:19
阅读次数:
273
【Fog】 Fog parameters are controlled with Fog command. Fogging blends the color of the generated pixels down towards a constant color based on dist...
分类:
其他好文 时间:
2014-07-26 14:57:00
阅读次数:
250
题目:Sort a linked list in O(n log n) time using constant space complexity.题解:考虑到要求用O(nlogn)的时间复杂度和constant space complexity来sort list,自然而然想到了merge sor....
分类:
编程语言 时间:
2014-07-26 09:51:57
阅读次数:
307
struts登录案例: struts.xml <struts> ?<constant name="struts.devMode" value="true" /> ?<constant name="struts.custom.i18n.resources" value="messages"></constant> ?<package name="basic" extends="...
分类:
其他好文 时间:
2014-07-25 00:09:34
阅读次数:
336
When a java class is load by classloader, where the constant poll be put?已编译类和原来的类源码区别在于,已编译类只包含类本身,内部类不会在已编译类中出现,而是生成另外一个已编译类文件;其二,已编译类中没有注释;其三,已编译类没...
分类:
编程语言 时间:
2014-07-24 12:18:55
阅读次数:
282
";//定义一个常量define("GREETING","Hello world!");echo constant("GREETING")."";$a = 10;$b = "10a";echo (string)$a == $b;//数字与字符串比较时, 先尝试将字符串转换为数字, 再比较, 一个不能...
分类:
Web程序 时间:
2014-07-22 22:41:32
阅读次数:
228
map
--------------------------------------------------------------------------------
所有元素都会根据元素的键值自动被排序。
map的所有元素都是 pair,同时拥有实值和键值。
不可以修改元素的键值,因为它关系到 map 元素的排列规则
可以修改元素的实值,因为它不影响 map 的排列规则
map iterator 既不是一种 constant iterators , 也不是一种 mutable iterator
标准 ...
分类:
其他好文 时间:
2014-07-22 22:34:34
阅读次数:
312
What if the given tree could be any binary tree? Would your previous solution still work?Note:You may only use constant extra space.For example,Given ...
分类:
其他好文 时间:
2014-07-22 08:37:34
阅读次数:
289
Apparently BFS is the most obvious one.. but it is not that simple - only constant extra space is provided.Then the only strategy to take is recursion...
分类:
其他好文 时间:
2014-07-22 00:39:35
阅读次数:
258
Sort ListSort a linked list inO(nlogn) time using constant space complexity.算法思想:时间复杂度为O(nlogn)的排序算法,有快排、归并、堆排序,快排需要往前遍历,因此不适合单链表,堆排序可以,但是需要O(n)的空间,因此...
分类:
其他好文 时间:
2014-07-22 00:03:35
阅读次数:
187