Given a binary tree, determine if it is 
height-balanced.For this problem, a height-balanced binary tree is defined as a 
binary tree in which the depth...
                            
                            
                                分类:
其他好文   时间:
2014-05-19 20:40:55   
                                阅读次数:
278
                             
                    
                        
                            
                            
                                题目链接:HDU 2795 Billboard【题意】给你一张h*w(1 7 #include 
8 #include 9 using namespace std;10 const int MAX = 200005;11 12 int tree[MAX= 
val)26 {27 ...
                            
                            
                                分类:
其他好文   时间:
2014-05-19 10:09:17   
                                阅读次数:
419
                             
                    
                        
                            
                            
                                题目链接:HDU 1394 Minimum Inversion 
Number【题意】给你一个1~N的数字组成的初始序列,然后每一次都将第一个数字移到最后,形成新的序列,然后求出这些序列的逆序数中的最小值。【思路】开始可以用任意一种方法(线段树 
or 暴力 or 树状数组)计算出初始数列的逆序数sum...
                            
                            
                                分类:
其他好文   时间:
2014-05-19 09:50:31   
                                阅读次数:
282
                             
                    
                        
                            
                            
                                Given a binary tree, determine if it is a valid 
binary search tree (BST).Assume a BST is defined as follows:The left subtree of 
a node contains only n...
                            
                            
                                分类:
其他好文   时间:
2014-05-19 07:23:48   
                                阅读次数:
357
                             
                    
                        
                            
                            
                                /*html5doctor.comResetStylesheetv1.6.1LastUpdated:2010-09-17Author:RichardClark-http://richclarkdesign.comTwitter:@rich_clark*/html,body,div,span,obje...
                            
                            
                                分类:
Web程序   时间:
2014-05-18 19:33:27   
                                阅读次数:
327
                             
                    
                        
                            
                            
                                伸展树概念 伸展树(Splay Tree)是一种二叉排序树,它能在O(log 
n)内完成插入、查找和删除操作。它由Daniel Sleator和Robert Tarjan创造。 (01) 
伸展树属于二叉查找树,即它具有和二叉查找树一样的性质:假设x为树中的任意一个结点,x节点包含关键字key,节点x...
                            
                            
                                分类:
其他好文   时间:
2014-05-18 19:17:30   
                                阅读次数:
225
                             
                    
                        
                            
                            
                                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 14:45:17   
                                阅读次数:
290
                             
                    
                        
                            
                            
                                css样式 .remind span 
{display:block;margin-top:-22px;} .remind a:hover {padding-top:22px;}.remind a 
{float:left;overflow:hidden;}.remind{height:22px;lin...
                            
                            
                                分类:
Web程序   时间:
2014-05-16 00:28:02   
                                阅读次数:
417
                             
                    
                        
                            
                            
                                原题:
题目解析:这个问题的实质是要我们按成访问二叉树的结点,并返回每层访问的结果,这里要求走Z字,其实就是一行正向一行反向。
/*
  the kernel idea is visit a binary search tree in level and 
  the additional work we have to label the end of one level.
*/
v...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 23:18:46   
                                阅读次数:
515
                             
                    
                        
                            
                            
                                裸题,瞬秒。。
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;
#define L(id) tree[id].ch[0]
#define R(id) tree[id].ch[1]
#define Size(id) tree[id].size
#...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 22:52:51   
                                阅读次数:
328