next up previous
Next: Up: Previous:

Searching

Search(n, k)             ; n is a pointer to a node, not the tree itself
   if n=NIL or k=key(n)  ; Initially n points to the root node
   then return n
   if k < key(n)
   then return Search(left(n), k)
   else return Search(right(n), k)



Example: Search(Root(T), 14)


next up previous
Next: Up: Previous: