segment trees for range minimum query