【题目】
Two elements of a binary search tree (BST) are swapped by mistake.
Recover the tree without changing its structure.
Note:
A solution using O(n) space is pretty straight forward. Could you devise a constant space solution?
confused what "{1,#,2,3}" ...
分类:
其他好文 时间:
2014-06-02 10:38:17
阅读次数:
246
Sort ListSort a linked list inO(nlogn) time
using constant space
complexity.要求时间复杂度为O(nlogn),那么不能用quickSort了(最坏O(n^2)),所以使用mergeSort.通常写排序算法都是基于数组的,这题...
分类:
其他好文 时间:
2014-06-02 06:29:51
阅读次数:
192
java 中的内存分为四个部分:stack(栈),heap(堆),data segment, codesegment。
stack(栈):存放基本类型的数据和对象的引用,即存放局部变量。
heap(堆)存放 new 出来的东西。
data segment(数据区):分为静态区和常量区(常量池):
静态区(static segment):存放在对象中用 static 定义的静态成员(即静态变量,如果该静态变量是基本类型变量,则将变量名和值都存入静态区中,如果是引用类型则指向 new 出来的对象。
...
分类:
编程语言 时间:
2014-06-01 15:09:19
阅读次数:
348
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....
分类:
其他好文 时间:
2014-06-01 10:41:23
阅读次数:
242
Sort a linked list inO(nlogn) time using
constant space complexity./** * Definition for singly-linked list. * struct
ListNode { * int val; * L...
分类:
其他好文 时间:
2014-05-30 15:17:18
阅读次数:
312
组件如下:对计算类型的说明如下:The table below contains
descriptions associated with the calculator step:FunctionDescriptionRequired
fieldsSet field to constant ACre...
分类:
其他好文 时间:
2014-05-28 04:19:05
阅读次数:
1256
查找资料的时候发现不错的文章,自己翻译之后分享给大家!一个基本的该类型字符串例子:@"This
is a constant character string object";在后台显示它:NSLog (@"%@", @"This is a constant
character string obje...
分类:
其他好文 时间:
2014-05-26 20:34:38
阅读次数:
278
Problem B Back to High School Physics Input:
standard input Output: standard output A particle has initial velocity and
constant acceleration. If its ...
分类:
其他好文 时间:
2014-05-26 15:14:39
阅读次数:
221
在struts2中需要做国际化的有:
jsp页面的国际化,action错误信息的国际化,转换错误信息的国际化,校验错误信息的国际化
在之前的例子中已经做过和国际化相关的例子了,在struts.xml中配置过
view
plaincopy
to clipboardprint?
constant name="struts.custom....
分类:
其他好文 时间:
2014-05-24 19:14:09
阅读次数:
339
【题目】
Given an unsorted integer array, find the first missing positive integer.
For example,
Given [1,2,0] return 3,
and [3,4,-1,1] return 2.
Your algorithm should run in O(n) time and uses constant space.
【题意】
给定一个数组,找出第一个缺失的正数。时间复杂度O(n)
...
分类:
其他好文 时间:
2014-05-21 17:13:07
阅读次数:
219