Data Structures/Implicit Segment Tree.cpp
// If we're trying to access a nonexistent node, we create it
If we're trying to access a nonexistent node, we create it
If we ' re trying to access a nonexistent node we create it
void newNode(node* curr, char dir)
{
    node* chd = new node();
    if(dir == 'l')
    {
        chd -> l = curr -> l;
        chd -> r = curr -> middle();
        curr -> left = chd;
    }
    else
    {
        chd -> l = curr -> middle() + 1;
        chd -> r = curr -> r;
        curr -> right = chd;
    }
}
void newNode ( node * curr , char dir ) { node * chd = new node ( ) ; if ( dir == ' ' ) { chd -> l = curr -> l ; chd -> r = curr -> middle ( ) ; curr -> left = chd ; } else { chd -> l = curr -> middle ( ) + 1 ; chd -> r = curr -> r ; curr -> right = chd ; } }
If we're trying to access a nonexistent node, we create it
If we ' re trying to access a nonexistent node we create it