I want to know how many nodes are there in a segment tree made for solving range minimum query problem.
Also, how much time does the build operation take and why?
I want to know how many nodes are there in a segment tree made for solving range minimum query problem.
Also, how much time does the build operation take and why?
if u use segment tree, build is O(nlgn), each query is O(lgn)
if the array is static, u can also try another algorithm RMQ. build time is O(nlgn) and each query is only O(1).
Segment Tree Complexity: