[Home]
[Chapter]
[Contents]
[Previous Algorithm]
[Next Algorithm]


Binary tree search


procedure search( key : typekey; t : tree ); begin if t=nil then {*** Not Found ***} notfound( key ) else if t^.k = key then {*** Found ***} found( t^ ) else if t^.k < key then search( key, t^.right ) else search( key, t^.left ) end;

C source (3411.srch.c) Pascal source (3411.srch.p)



© Addison-Wesley Publishing Co. Inc.