Exemple #1
0
void Store::stop()
{
    if(_isRunning)
    {
        _cleanUp();
        
        std::unique_lock<std::mutex> lck(_mtx);
        _isRunning = false;
        _cv.notify_all();
    }
    
}
inline Node* LinkCutTree::_liftUpToRoot(Node* vertex) {
    if(!vertex) {
        return nullptr;
    }
    
    if(!vertex->parent) {
        return vertex;
    }
    
    Node* root = _cleanUp(vertex);
    root->treePtr->splay(vertex);
    return vertex;
}
Node* LinkCutTree::_cleanUp(Node* vertex) {
    Node* root;
    
    if(vertex->parent) {
        root = _cleanUp(vertex->parent);
    } else {
        root = vertex;
    }
    
    Node::push(vertex);
    
    return root;
}