Posted on Jul 31
RMQ can be used to query minimum/maximum value in a specified interval with time complexity of \(O(\log n)\).
Here is another implementation sample of RMQ in a templated OO style.
It may be better if it has the ability to change the min
function to max
or similar.
However, I think that the plain old procedural style is satisfactory in most cases and this kind of generality is not necessary.
2015 My gh-pages