Given an array where elements are sorted in ascending order, convert it to a height balanced BST.
class Solution {
public:
vector Num;
TreeNode *sortedArrayToBST(vector &num) {
if (num.size() == 0) r...
分类:
其他好文 时间:
2015-03-21 11:24:00
阅读次数:
169
#判断运算符的优先级
def opOrder(op1,op2):
order_dic = {'*':4,'$':5,'/':4,'+':3,'-':3}
if op1 == '(' or op2 == '(':
return False
elif op2 == ')':
return True
else:
if orde...
分类:
编程语言 时间:
2015-03-20 22:09:43
阅读次数:
261
题目:
Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.The brackets must close in the correct order, “()” and “()[]{}” are all valid...
分类:
其他好文 时间:
2015-03-20 22:03:10
阅读次数:
125
题目链接:Sort Colors
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.
Here, we will u...
分类:
其他好文 时间:
2015-03-20 22:01:20
阅读次数:
169
思路:
具体的思路和层序遍历一致,只是需要将偶数层的结点值颠倒一下即可,时间略长,可见本方法并非好的方法。思路详见层序遍历:http://blog.csdn.net/mnmlist/article/details/44490975...
分类:
其他好文 时间:
2015-03-20 16:28:25
阅读次数:
131
Sometimes we'll want to sort a collection by something other than its natural order. For example, suppose we wanted to sort strings by their length in...
分类:
其他好文 时间:
2015-03-20 16:17:47
阅读次数:
107
一般的层序遍历直接打印出结果,用队列即可,但是此次的要求尼是按层次打印结果,所以考虑到用两个队列来交替存储,遍历上一层次的同时将下一层的结点存储到另一个队列中,并在将上面一层的遍历完成后交换两个队列的值。...
分类:
其他好文 时间:
2015-03-20 14:28:08
阅读次数:
140
一般的层序遍历直接打印出结果,用队列即可,但是此次的要求尼是按层次打印结果,所以考虑到用两个队列来交替存储,遍历上一层次的同时将下一层的结点存储到另一个队列中,并在将上面一层的遍历完成后交换两个队列的值。最后,将结果列表调换下顺序即可。...
分类:
其他好文 时间:
2015-03-20 14:25:18
阅读次数:
131
在apche conf文件中配置 Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all其中xxx指你的ci目录然后再在ci目录中添加.htaccess文件,内容如下Re...
分类:
Web程序 时间:
2015-03-20 12:42:19
阅读次数:
169
private void setOneMenu()
{
string sql = "select id,name,gids from Config where name'基础设置' order by [Order] desc";
DataTable dt = Sunway.DBUtility.DbHelperSQL.ExecuteDataSet(Comman...
分类:
Web程序 时间:
2015-03-20 11:02:38
阅读次数:
160