next up previous
Next: Analysis Up: CSE 2320: Algorithms and Previous: Analysis

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)



Copyright © 1998 The University of Texas at Arlington