public:
Position find(const Key& k) { // find a key
BTPosition p = finder(k, T.root()); // search for it
if (T.isInternal(p)) // found it
return Position(p); // return its position
else // didn't find it
return Position(NULL); // return null position
}
protected:
BTPosition finder(const Key& k, const BTPosition& p) {// find utility
if (T.isExternal(p)) return p; // key not found
Key curKey = key(p); // key of current node
if (k < curKey)
return finder(k, T.leftChild(p)); // search left subtree
else if(k > curKey)
return finder(k, T.rightChild(p)); // search right subtree
else // found it
return p; // return this position
}