Changeset 4077 for branches/kendall-score/yat/utility/ranking/Impl.cc
- Timestamp:
- Aug 26, 2021, 6:07:09 AM (19 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/kendall-score/yat/utility/ranking/Impl.cc
r4075 r4077 189 189 190 190 void Impl::insert_and_rebalance(std::unique_ptr<NodeBase>&& element, 191 NodeBase& parent, NodeBase*& child) 192 { 193 assert(child == nullptr); 194 child = element.release(); 191 NodeBase& parent, bool left) 192 { 193 NodeBase* child = nullptr; 194 if (left) { 195 parent.left_ = element.release(); 196 child = parent.left_; 197 if (&parent == left_most()) 198 left_most() = child; 199 } 200 else { 201 parent.right_ = element.release(); 202 child = parent.right_; 203 } 204 195 205 child->parent_ = &parent; 196 206 parent.increment_size(); 197 207 parent.update_height_recursively(); 198 199 208 insert_rebalance(&parent, child); 200 209 } … … 458 467 459 468 469 NodeBase* Impl::right_most(void) 470 { 471 // FIXME this scaled logN, make it constant time 472 return root_node()->right_most(); 473 } 474 475 476 const NodeBase* Impl::right_most(void) const 477 { 478 // FIXME this scaled logN, make it constant time 479 return root_node()->right_most(); 480 } 481 482 460 483 NodeBase*& Impl::root_node(void) 461 484 {
Note: See TracChangeset
for help on using the changeset viewer.