previous | start | next

Computing Key floor(Key k)

Invariants

 t: Node reference to subtree that contains floor of k or else contains no keys
 smaller than k.


 candidate: Node not in t whose key is the largest key less than k in
            the whole tree or null if there is no such Node in the tree.
   

Since the subtree referenced by t gets smaller with each step, this will eventually find the floor.



previous | start | next