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...
分类:
其他好文 时间:
2014-07-30 17:46:04
阅读次数:
244
js中处理正则表达式的类:RegExp用法: var reg=new RegExp("express");或者: var reg=/express/;js中常用的6个方法: test():是否存在 exec():返回查询值 match():得到查询的数组 search():返回搜索的位置 rep.....
分类:
编程语言 时间:
2014-07-30 17:13:13
阅读次数:
282
git上的项目基本都可以用cocoapods导入 特别方便。使用方法:更新cocoapods :$ sudo gem update cocoapods查询第三方库是否存在:$ pod search xxx导入第三方库:进入项目的根目录,并在根目录下创建一个名叫Podfile的文件(没有任何后缀):$...
分类:
其他好文 时间:
2014-07-30 11:37:43
阅读次数:
199
DFS(Depth First Search) 深度优先搜索BFS (Breadth First Search)宽度优先搜索在算法中常用这两种方法。1) DFS考虑用“递归”实现和用 “栈”实现两种方法,因为对于大型问题搜索深度比较深,如果用递归实现的话,栈空间占用比较多,递归调用需要的额外时间也比...
分类:
其他好文 时间:
2014-07-30 09:54:03
阅读次数:
234
/*
* javaBean代码
*/
package bean;
public class Box {
double length;
double width;
double height;
public Box()
{
length=0;
width=0;
height=0;
}
public double getLength() {
return lengt...
分类:
编程语言 时间:
2014-07-29 21:57:02
阅读次数:
356
新建的一个项目中,出现编译错误,发现是缺少了libxml2.dylib,后面将这个资源包添加了,编译还是出现标题上所说的问题 解决办法: 在Header Search Paths下的Debug和release下添加下面的设置 ${SDKROOT}/usr/inc...
分类:
移动开发 时间:
2014-07-29 18:27:52
阅读次数:
231
Convert Sorted List to Binary Search TreeTotal Accepted:12283Total Submissions:45910My SubmissionsGiven a singly linked list where elements are sorted...
分类:
其他好文 时间:
2014-07-29 17:29:32
阅读次数:
216
本片开始一下表单的验证内容。比如我们要控制输入,不能空,不能过长,邮箱正确,密码强度等等。普遍的js前端验证简单说明,不是学习Django的重点。我们只需要修改上篇中的search_form.html模板,给submit添加一个客户端事件即可,修改如下 1 2 3 Search 4 ...
分类:
其他好文 时间:
2014-07-29 17:18:42
阅读次数:
350
" class="text-box single-line" style="width:108px;" />
分类:
其他好文 时间:
2014-07-29 16:41:41
阅读次数:
127
描述:递归代码: 1 class Solution: 2 # @param num, a list of integers 3 # @return a tree node 4 def sortedArrayToBST(self, num): 5 if len(...
分类:
其他好文 时间:
2014-07-29 16:41:11
阅读次数:
210