题目:二叉树的中序遍历。思路:用递归来写中序遍历非常简单。但是题目直接挑衅说,----->"Recursive
solution is trivial"。好吧。谁怕谁小狗。递归代码: 1 List inOrder = new ArrayList(); 2 3 public
...
分类:
其他好文 时间:
2014-06-29 12:55:36
阅读次数:
176
原题地址:https://oj.leetcode.com/problems/search-a-2d-matrix/题意:Write
an efficient algorithm that searches for a value in anmxnmatrix. This matrix has
the...
分类:
编程语言 时间:
2014-06-29 07:56:13
阅读次数:
321
题目链接判断一颗二叉树是否是二叉搜索树(二叉排序树),也就是BST如果该二叉树是BST, 那么对其中序遍历,所得序列一定是单调递增的(不考虑有重复数值的情况)附上代码:
1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 *...
分类:
其他好文 时间:
2014-06-07 11:28:18
阅读次数:
254
python中import一个模块时python解释器的搜索目录顺序:参考python帮助文档The
Module Search PathWhen a module namedspamis imported, the interpreter first
searches for a built-in...
分类:
其他好文 时间:
2014-06-06 09:45:30
阅读次数:
250
首先从简单的搜索开始——empty
search,这个搜索返回所有的index中所有的document。GET
/_search{}标记1表示的是请求体就像query-string搜索一样,你能对若干index进行搜索,同时能指定若干若干类型:GET
/index_2014*/type1,type2...
分类:
其他好文 时间:
2014-06-06 08:43:17
阅读次数:
228
轻量级的搜索——?query string
search?——对命令行的即席查询来说是十分有用的。然而为了驾驭搜索的强大功能,你应该使用带请求体的search
API,之所以这样,是因为很多的参数是在JSON的请求体中的而不是查询字符串。请求体查询——从现在开始就是”search“——不仅仅自身处理...
分类:
其他好文 时间:
2014-06-06 08:21:47
阅读次数:
239
除了前面已经提到的简单的数据类型,JSON也有null,array和object类型,这些都是被ES支持的。Multi-value
fields我们想让我们的tag
field的值多于一个而不是一个字符串,这个也是可能的,我们能把一个数组存储到tags:{"tag":["search","nosql...
分类:
其他好文 时间:
2014-06-06 08:15:06
阅读次数:
316
Given a binary tree, find its maximum depth.The
maximum depth is the number of nodes along the longest path from the root node
down to the farthest le...
分类:
其他好文 时间:
2014-06-05 14:10:38
阅读次数:
304
Given a binary tree struct TreeLinkNode {
TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next
pointe...
分类:
其他好文 时间:
2014-06-05 13:42:24
阅读次数:
264
Follow up for problem "Populating Next Right
Pointers in Each Node".What if the given tree could be any binary tree? Would
your previous solution stil...
分类:
其他好文 时间:
2014-06-05 13:26:37
阅读次数:
335