Block - violence that is justice

    I.e. block beautiful violence, by reducing the complexity of the array into pieces. Block segment tree can maintain the information poor maintenance or simply can not maintain. Segment tree maintenance information must be combined, monotonicity and the like, while the requirements of the nature of the information block is not so critical. However, thinking, and the block is very similar to the segment tree, to reduce the complexity by labeling the like operation.

The basic definition:

    A sequence of length N, the block size of block, starting with the first element of the sequence, each block as one block unit, if the last remaining block of less than one block, the block is self-contained.

    The size of each block (block) is . ( Maybe not the best, but generally meet most of the questions asked)

    Block number (CNT) is N = CNT / Block + (N Block% == 0:? 0:. 1)

    Belonging to position i (i-1) / block + 1 block .

    Range to the i-th block  .

    Block: block operation section completely covered.

    Side blocks: block operation section is not completely covered.

Basic operation:

   For the section there are two operation cases. (L where blocks bl, where R is a block br)

     ① interval in the same block (bl = br): Reconstruction of violence.

     ② interval not in the same block (bl> br):

       Left block: violence reconstruction.

       The right block: violence reconstruction.

       Intermediate piece: bl + 1, bl + 2, ......, br-1, operated by the like numerals array.

Modify the interval, single-point summation:

To modify the interval, single-point summation example.

 

Attachment: block 9 topic

Guess you like

Origin www.cnblogs.com/VividBinGo/p/11307991.html