sir i am not able to understand that what value should be returned in case of “NO” overlapp in a query . To find the minimum element in a range we returned INT_MAX and in case of this ques https://www.spoj.com/problems/GSS1/
code https://ide.codingblocks.com/s/4402
we returned a node with all values as INT_MIN
"NO" overlapp in Segment Trees
It depends on the motive of the program. A No-overlap case shouldn’t affect your answer. Say, If you’re finding the minimum element in a range, then a no-overlap must return INT_MAX so that when you take minimum of (some_value, INT_MAX) , the ans (some_value) isn’t affected. Similarly, if we calculate max element in a range, we’ll return INT_MIN.
1 Like
Thank u very much. I got it