如果是1~n 个数 那么我们知道线段树 最后一层 一定是n个结点!
那么 可得线段树 最多的结点数为 2^(log2(n)+1)-1 或者 2*n-1个
单点更新
HDU1754
//9596209 2013-11-16 12:13:35 Accepted 1754 531MS 7184K 1579 B
#include <iostream>
#include<cstdio>
using namespace std;
#define MAX 200002
int val[MAX];
struct Node
{
int left,right,max;
}tree[3*MAX];
int max(int a,int b)
{
return a>b?a:b;
}
int creat(int root,int left,int right)
{
tree[root].left=left;
tree[root].right......
阅读全文