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 ...
分类:
其他好文 时间:
2014-05-17 11:30:21
阅读次数:
247
原文http://knowyouknowme.iteye.com/blog/574974一、decode在Oracle/PLSQL中,decode具有和
IF-THEN-ELSE 一样的功能。decode函数语法如下:decode( expression , search , result [, s...
分类:
数据库 时间:
2014-05-16 20:41:51
阅读次数:
540
string strPatten = "(src|href)=(.*?)[>| ]";
string strContent = " "; Regex reg = new Regex(strPatten); foreach (Match match
in...
分类:
其他好文 时间:
2014-05-16 20:00:47
阅读次数:
266
官方demo见
https://github.com/square/otto注意自己该编译版本为2.3以上,默认的1.6不支持match_parent属性,导致布局文件出错。另外需要手动添加android-support-v4和otto到自己的libs文件夹。主要代码逻辑:1,在主页面点clear按...
分类:
移动开发 时间:
2014-05-16 19:19:36
阅读次数:
334
题意:在一个二维矩阵中找到给定的值。矩阵从上到下从左到右有序
思路:二维空间的二分查找
先在一维里找中间位置,再将该位置转为二维空间里的下标
注:下标比较难弄,得注意点
复杂度: 时间O(log n),空间O(1)
相关题目:
Search Insert Position...
分类:
其他好文 时间:
2014-05-15 07:24:42
阅读次数:
253
5道题目分别是:【Interleaving String】、【Validate Binary Search Tree】、【Sqrt(x) 】、【Recover Binary Search Tree 】、【Climbing Stairs 】,由于有一些题目不需要发一整篇博文来记录,所以就将这些题目以一篇博文5道来记录。...
分类:
其他好文 时间:
2014-05-15 06:30:55
阅读次数:
301
广度优先搜索(Breadth-First-Search)和深度优先搜索(Deep-First-Search)是搜索策略中最经常用到的两种方法,特别常用于图的搜索.其中有很多的算法都用到了这两种思想,比如:Dijkstra单源最短路径算法和Prim最小生成树算法都采用了和宽度优先搜索类似的思想。BFS...
分类:
其他好文 时间:
2014-05-14 12:29:53
阅读次数:
544
定义一个存储过程,用到游标,从一个表中取值,插入到另外一个表中。drop procedure
if exists search_test;create procedure search_test(in id int,out out_min_id
varchar(200))begindeclare f...
分类:
数据库 时间:
2014-05-14 07:41:31
阅读次数:
361
三个属性都用来适应视图的水平或垂直大小,一个以视图的内容或尺寸为基础的布局比精确地指定视图范围更加方便。1)fill_parent设置一个构件的布局为fill_parent将强制性地使构件扩展,以填充布局单元内尽可能多的空间。这跟Windows控件的dockstyle属性大体一致。设置一个顶部布局或...
分类:
移动开发 时间:
2014-05-14 07:02:27
阅读次数:
424
1.电话拨号器:
activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
a...
分类:
移动开发 时间:
2014-05-13 15:08:57
阅读次数:
508