hdu5044 Tree 树链剖分,点剖分,边剖分,非递归版
//#pragma warning (disable: 4786)
//#pragma comment (linker, "/STACK:16777216")
//#pragma comment(linker, "/STACK:60400000,60400000")
//HEAD
#include
#include
#i...
分类:
其他好文 时间:
2014-10-06 21:36:10
阅读次数:
663
在linux下我们经常用到的四个应用程序的目录是/bin、/sbin、/usr/bin、/usr/sbin 。而四者存放的文件一般如下: bin目录:bin为binary的简写主要放置一些系统的必备执行档例如:cat、cp、chmod df、dmesg、gzip、kill、ls、mkdir、more...
分类:
系统相关 时间:
2014-10-06 20:42:10
阅读次数:
259
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 nodes with keys less than the node's key.Th...
分类:
其他好文 时间:
2014-10-06 19:32:50
阅读次数:
173
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 pretty straight forward. Could you devis...
分类:
其他好文 时间:
2014-10-06 18:43:20
阅读次数:
201
题目链接:http://poj.org/problem?id=2255思路: 根据先序遍历(如DBACEGF)可以找出根结点(D),其后为左右子树; 根据中序遍历(如ABCDEFG),已知根结点(D),可以知道在根结点左边的为左子树结点(ABC),右边为右子树结点(EFG);可以求出左子树与右子.....
分类:
其他好文 时间:
2014-10-06 17:50:20
阅读次数:
169
转自:http://blog.csdn.net/acs713/article/details/6880375B-tree(多路搜索树,并不是二叉的)是一种常见的数据结构。使用B-tree结构可以显著减少定位记录时所经历的中间过程,从而加快存取速度。按照翻译,B 通常认为是Balance的简称.这个数...
分类:
其他好文 时间:
2014-10-06 17:03:30
阅读次数:
148
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).
For example:
Given binary ...
分类:
其他好文 时间:
2014-10-06 16:46:00
阅读次数:
165
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 leaf node.
/**
* Definition for binary tree
...
分类:
其他好文 时间:
2014-10-06 16:08:40
阅读次数:
181
Given preorder and inorder traversal of a tree, construct the binary tree.
Note:
You may assume that duplicates do not exist in the tree.
/**
* Definition for binary tree
* struct TreeNode {
...
分类:
其他好文 时间:
2014-10-06 14:46:30
阅读次数:
202
Given inorder and postorder traversal of a tree, construct the binary tree.
Note:
You may assume that duplicates do not exist in the tree.
/**
* Definition for binary tree
* struct TreeNode {...
分类:
其他好文 时间:
2014-10-06 14:45:50
阅读次数:
178