Binary search tree insertion
procedure insert( new : tree; var t : tree ); begin if t = nil then t := new else if t^.k < new^.k then insert( new, t^.right ) else insert( new, t^.left ) end;
Pascal
source (516c.ins.p)
©
Addison-Wesley
Publishing Co. Inc.