题目:二叉树的中序遍历。思路:用递归来写中序遍历非常简单。但是题目直接挑衅说,----->"Recursive 
solution is trivial"。好吧。谁怕谁小狗。递归代码: 1 List inOrder = new ArrayList(); 2 3 public 
...
                            
                            
                                分类:
其他好文   时间:
2014-06-29 12:55:36   
                                阅读次数:
176
                             
                    
                        
                            
                            
                                题目
Given a binary tree, return the inorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
   1
         2
    /
   3
return [1,3,2].
Note: Recur...
                            
                            
                                分类:
其他好文   时间:
2014-06-20 10:22:00   
                                阅读次数:
221
                             
                    
                        
                            
                            
                                题目链接判断一颗二叉树是否是二叉搜索树(二叉排序树),也就是BST如果该二叉树是BST, 那么对其中序遍历,所得序列一定是单调递增的(不考虑有重复数值的情况)附上代码: 
1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 *...
                            
                            
                                分类:
其他好文   时间:
2014-06-07 11:28:18   
                                阅读次数:
254
                             
                    
                        
                            
                            
                                Hash 索引结构的特殊性,其检索效率非常高,索引的检索可以一次定位,不像B-Tree 
索引需要从根节点到枝节点,最后才能访问到页节点这样多次的IO访问,所以 Hash 索引的查询效率要远高于 B-Tree 索引。可能很多人又有疑问了,既然 
Hash 索引的效率要比 B-Tree 高很多,为什么大家...
                            
                            
                                分类:
数据库   时间:
2014-06-06 21:42:24   
                                阅读次数:
344
                             
                    
                        
                            
                            
                                昨天写了 The Query on the 
Tree 的解题报告,但是遗留下一个问题,不能算是完美解决这道题.因为如果精心构造数据的话,昨天的题解还是会被卡住的.今天中午睡觉的时候突然想起一个不会被卡住的方法.题意  有一棵树,树的每个点有点权,每次有三种操作:  1. 
Query x 表示查询以x...
                            
                            
                                分类:
其他好文   时间:
2014-06-06 16:32:02   
                                阅读次数:
266
                             
                    
                        
                            
                            
                                转自: 
http://blog.chinaunix.net/uid-22663647-id-1771796.html1.二叉排序树的定义 二叉排序树(Binary 
Sort Tree)又称二叉查找(搜索)树(Binary Search Tree)。其定义为:二叉排序树或者是空树,或者是满足如下性质....
                            
                            
                                分类:
编程语言   时间:
2014-06-06 15:03:27   
                                阅读次数:
276
                             
                    
                        
                            
                            
                                Given a binary tree containing digits 
from0-9only, each root-to-leaf path could represent a number.An example is the 
root-to-leaf path1->2->3which rep...
                            
                            
                                分类:
其他好文   时间:
2014-06-06 12:38:42   
                                阅读次数:
255
                             
                    
                        
                            
                            
                                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