Skip to content

Commit 121ee2f

Browse files
committed
Fixed bug introduced in PR.
1 parent 21425cd commit 121ee2f

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

interval_tree.hpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,18 +1139,18 @@ namespace lib_interval_tree
11391139

11401140
// max fixup
11411141
if (x->left_ && x->right_)
1142-
x->max_ = std::max(x->max_, std::max(x->left_->max_, x->right_->max_));
1142+
x->max_ = std::max(x->interval_.high_, std::max(x->left_->max_, x->right_->max_));
11431143
else if (x->left_)
1144-
x->max_ = std::max(x->max_, x->left_->max_);
1144+
x->max_ = std::max(x->interval_.high_, x->left_->max_);
11451145
else if (x->right_)
1146-
x->max_ = std::max(x->max_, x->right_->max_);
1146+
x->max_ = std::max(x->interval_.high_, x->right_->max_);
11471147
else
11481148
x->max_ = x->interval_.high_;
11491149

11501150
if (y->right_)
1151-
y->max_ = std::max(y->max_, std::max(y->right_->max_, x->max_));
1151+
y->max_ = std::max(y->interval_.high_, std::max(y->right_->max_, x->max_));
11521152
else
1153-
y->max_ = std::max(y->max_, x->max_);
1153+
y->max_ = std::max(y->interval_.high_, x->max_);
11541154
}
11551155

11561156
void right_rotate(node_type* y)
@@ -1174,18 +1174,18 @@ namespace lib_interval_tree
11741174

11751175
// max fixup
11761176
if (y->left_ && y->right_)
1177-
y->max_ = std::max(y->max_, std::max(y->left_->max_, y->right_->max_));
1177+
y->max_ = std::max(y->interval_.high_, std::max(y->left_->max_, y->right_->max_));
11781178
else if (y->left_)
1179-
y->max_ = std::max(y->max_, y->left_->max_);
1179+
y->max_ = std::max(y->interval_.high_, y->left_->max_);
11801180
else if (y->right_)
1181-
y->max_ = std::max(y->max_, y->right_->max_);
1181+
y->max_ = std::max(y->interval_.high_, y->right_->max_);
11821182
else
11831183
y->max_ = y->interval_.high_;
11841184

11851185
if (x->left_)
1186-
x->max_ = std::max(x->max_, std::max(x->left_->max_, y->max_));
1186+
x->max_ = std::max(x->interval_.high_, std::max(x->left_->max_, y->max_));
11871187
else
1188-
x->max_ = std::max(x->max_, y->max_);
1188+
x->max_ = std::max(x->interval_.high_, y->max_);
11891189
}
11901190

11911191
void recalculate_max(node_type* reacalculation_root)

0 commit comments

Comments
 (0)