线段树不是完全二叉树,是平衡二叉树 堆也是平衡二叉树 堆满二叉树: h层,一共有2^h-1个节点(大约是2^h) 最后一层(h-1层)有2^(h-1)个节点 最后一层的节点数大致等于前面所有层节点之和 如果区间有n个元素,数组表示需要4n的空间 不考虑添加元素,使用4n的静态空间即可 接口: public interface Merger<E> { E merge(E a, E b); } public class SegmentTree<E> { private E[] tree…
Description Byteman, one of the most deserving employee of The Goldmine of Byteland, is about to retire by the end of the year. The Goldmine management would like to reward him in acknowledgment of his conscientious work. As a reward Byteman may rec…
Problem Description One day, a useless calculator was being built by Kuros. Let's assume that number X is showed on the screen of calculator. At first, X = 1. This calculator only supports two types of operation. 1. multiply X with a number. 2. divid…
Doom Time Limit: 12000/6000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 1401 Accepted Submission(s): 368 Problem Description THE END IS COMINGGGGGG! Mike has got stuck on a mystery machine. If he cannot solv…