build/module/RBTree.js
function lub(tree, node, key, comp, high) {
    if (node === tree.z) {
        return high;
    }
    else if (comp(key, node.key) <= 0) {
        // The node key is a valid upper bound, but may not be the least.
        return minNode(node, lub(tree, node.l, key, comp, high), comp);
    }
    else {
        // Take the right link in search of bigger keys.
        return lub(tree, node.r, key, comp, high);
    }
}
function lub(tree, node, key, comp, high) {
    if (node === tree.z) {
        return high;
    }
    else if (comp(key, node.key) <= 0) {
        // The node key is a valid upper bound, but may not be the least.
        return minNode(node, lub(tree, node.l, key, comp, high), comp);
    }
    else {
        // Take the right link in search of bigger keys.
        return lub(tree, node.r, key, comp, high);
    }
}
function lub ( tree , node , key , comp , high ) { if ( node === tree . z ) { return high ; } else if ( comp ( key , node . key ) <= 0 ) { // The node key is a valid upper bound, but may not be the least. return minNode ( node , lub ( tree , node . l , key , comp , high ) , comp ) ; } else { // Take the right link in search of bigger keys. return lub ( tree , node . r , key , comp , high ) ; } }
Recursive implementation to compute the Least Upper Bound.
The smallest key such that key <= lub.
Recursive implementation to compute the Least Upper Bound . The smallest key such that key < = lub .