Convert Sorted List to Binary Search TreeGiven a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST....
分类:
其他好文 时间:
2015-04-04 15:01:48
阅读次数:
117
1. 查询多行记录,以sql的md5值为key,缓存数组(个人觉得最好用的方法)$mem = new Memcache();$mem->connect('127.0.0.1',11211);$id = (int)$_GET['id'];$sql = "SELECT * FROM test WHERE...
分类:
Web程序 时间:
2015-04-04 13:35:13
阅读次数:
232
题目:
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.
思路:从一个数组中找到中间的元素作为BST的根,然后坐边的作为左子树,右边的作为右子树,递归调用
#include
#include
#include
#include
...
分类:
其他好文 时间:
2015-04-04 12:18:29
阅读次数:
132
题目:
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.
思路:和上面的思想一样,只不过注意找到链表的中间节点的方法
void Inorder(BinTree* root)
{
if(root == NULL)
...
分类:
其他好文 时间:
2015-04-04 12:17:29
阅读次数:
136
[field:id runphp='yes']$aid = @me;$row = $GLOBALS['dsql']->GetOne("Select tu2 From `#@__addonarticle` where aid='$aid' ");@me = "{$row['tu2']}";[/fie....
分类:
数据库 时间:
2015-04-04 10:40:42
阅读次数:
220
Given two values k1 and k2 (where k1 k1, 如果否,则不需要继续向左递归;右子树的处理方法类似 1 public class Solution { 2 /** 3 * @param root: The root of the binary s...
分类:
其他好文 时间:
2015-04-04 06:43:33
阅读次数:
138
select*fromtablewhereROWNUM<100;ROWNUM<你想要输出的数目,写在where后
分类:
数据库 时间:
2015-04-03 19:37:15
阅读次数:
161
关于SQL SERVER的表联接查询INNER JOIN 、LEFT JOIN和RIGHT JOIN,经常会用到ON和WHERE的条件查询,以前用的时候有时是凭感觉的,总是没有搞清楚,今日亲自测试了下,理解到了一些内容,在此分享。要测试,首先我们来创建三张表,数据库就根据自己的情况而定创建表Test...
分类:
数据库 时间:
2015-04-03 19:15:43
阅读次数:
138
Select语句完整的执行顺序:1、from子句组装来自不同数据源的数据;2、where子句基于指定的条件对记录行进行筛选;3、group by子句将数据划分为多个分组;4、使用聚集函数进行计算;5、使用having子句筛选分组;6、计算所有的表达式;7、使用order by对结果集进行排序。8、s...
分类:
数据库 时间:
2015-04-03 18:59:00
阅读次数:
138
题目链接:Largest Rectangle in Histogram
Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.
...
分类:
其他好文 时间:
2015-04-03 17:18:59
阅读次数:
128