Segment tree (a): amend point

    Minimum dynamic range problem. Given an array $ A_1 $ n $ elements, A_2, ..., A_n $, your task is to design a data structure that supports the following two operations:

  • $ Update (x, v) $: the $ A_x $ revised to $ v $
  • $ Query (L, R) $: calculated $ min {A_L, A_ {L + 1}, ..., A_R} $

    If you still use $ Sparse-Table $ algorithm, each $ Update $ operations need to be recalculated $ d $ array, can not afford the time. To solve this problem, introduce here a flexible data structure: tree line (segment tree).

    At query time, we are starting from the root to find a top-down left and right borders of the segment to be queried, then "caught in the middle" of all leaf nodes do not repeat do not miss it covers the entire query segments to be. Not found from FIG.

 

Guess you like

Origin www.cnblogs.com/lfri/p/11094711.html