Click here to see the full article post
"Implementing Segment Trees is discussed in more detail here" - the link appears broken.
Maybe a problem in python version of Approach #2: Segment Tree
- range_mid will get a float, so in function insert, the equation will hardly true, I think the range_mid should return an interger
- I think this algorithm will be inefficient in some situation: [1, 5, 50, 32, 99999999], that is, when the range of min value to max value is too large with only few numbers. Because the insert will continue go deeper until come to a leaf (a value).
Welcome to discuss