intervaltree icon indicating copy to clipboard operation
intervaltree copied to clipboard

Add min() and max() method to get the extent of a tree.

Open BenFrantzDale opened this issue 7 years ago • 1 comments

BenFrantzDale avatar Apr 13 '18 18:04 BenFrantzDale

It's time to implement tests for this kind of question.

On Fri, Apr 13, 2018, 21:49 Ben FrantzDale [email protected] wrote:

@BenFrantzDale commented on this pull request.

In IntervalTree.h https://github.com/ekg/intervaltree/pull/21#discussion_r181493591:

@@ -158,6 +158,18 @@ class IntervalTree { assert(is_valid().first); }

  • Scalar min() const {
  •    assert(!empty());
    
  •    if (left) { return left->min(); }
    
  •    return std::min_element(intervals.begin(), intervals.end(),
    
  •                            IntervalStartCmp())->start;
    
  • }
  • Scalar max() const {

Is this right, or do we need to do max of right->max() and everything in this tree node?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ekg/intervaltree/pull/21#pullrequestreview-112138905, or mute the thread https://github.com/notifications/unsubscribe-auth/AAI4ESWTh5OdZKQi5JVOf1qNdVlSzc2dks5toQFGgaJpZM4TT6xC .

ekg avatar Apr 20 '18 07:04 ekg