when calling DescendRange methods, an iteration is performed. All items between [lessOrEqual, greaterThan ) are iterated. Suppose there're n items in the range, I though ___Less___ function is called log(n) times. However, ___Less___ is called more than n times as a matter of ``` if stop != nil && !n.items[i].Less(stop) { return hit, false } ``` Why make comparisons this way? I though if parent node can decide all its children are in the range, most ___Less(stop)___ call can be optimized out. Are there anything wrong with this idea?
when calling DescendRange methods, an iteration is performed.
All items between [lessOrEqual, greaterThan ) are iterated.
Suppose there're n items in the range, I though Less function is called log(n) times.
However, Less is called more than n times as a matter of
Why make comparisons this way? I though if parent node can decide all its children are in the range, most Less(stop) call can be optimized out.
Are there anything wrong with this idea?