build/module/RBTree.js
function glb(tree, node, key, comp, low) {
    if (node === tree.z) {
        return low;
    }
    else if (comp(key, node.key) >= 0) {
        // The node key is a valid lower bound, but may not be the greatest.
        // Take the right link in search of larger keys.
        return maxNode(node, glb(tree, node.r, key, comp, low), comp);
    }
    else {
        // Take the left link in search of smaller keys.
        return glb(tree, node.l, key, comp, low);
    }
}
function glb(tree, node, key, comp, low) {
    if (node === tree.z) {
        return low;
    }
    else if (comp(key, node.key) >= 0) {
        // The node key is a valid lower bound, but may not be the greatest.
        // Take the right link in search of larger keys.
        return maxNode(node, glb(tree, node.r, key, comp, low), comp);
    }
    else {
        // Take the left link in search of smaller keys.
        return glb(tree, node.l, key, comp, low);
    }
}
function glb ( tree , node , key , comp , low ) { if ( node === tree . z ) { return low ; } else if ( comp ( key , node . key ) >= 0 ) { // The node key is a valid lower bound, but may not be the greatest. // Take the right link in search of larger keys. return maxNode ( node , glb ( tree , node . r , key , comp , low ) , comp ) ; } else { // Take the left link in search of smaller keys. return glb ( tree , node . l , key , comp , low ) ; } }
Recursive implementation to compute the Greatest Lower Bound.
The largest key such that glb <= key.
Recursive implementation to compute the Greatest Lower Bound . The largest key such that glb < = key .