node current root/find node with given key /(assumes non-empty tree/start at root while(current idata !key/while no matchif(key current idata/go leftcurrent current leftchildelse current current rightchild/or go rightif(current =null/if no childreturn null/didn' find it return current/found it this routine uses variable current to hold the node it is currently examining the argument key is the value to be found the routine starts at the root (it has tothis is the only node it can access directly that isit sets current to the root thenin the while loopit compares the value to be foundkeywith the value of the idata field (the key fieldin the current node if key is less than this fieldthen current is set to the node' left child if key is greater than (or equalto the node' idata fieldthen current is set to the node' right child can' find it if current becomes equal to nullthen we couldn' find the next child node in the sequencewe've reached the end of the line without finding the node we were looking forso it can' exist we return null to indicate this fact found it if the condition of the while loop is not satisfiedso that we exit from the bottom of the loopthen the idata field of current is equal to keythat iswe've found the node we want we return the nodeso that the routine that called find(can access any of the node' data efficiency as you can seehow long it takes to find node depends on how many levels down it is situated in the workshop applet there can be up to nodesbut no more than levels-so you can find any node using maximum of only comparisons this is (logntimeor more specifically (log ntimethe logarithm to the base we'll discuss this further toward the end of this inserting node to insert node we must first find the place to insert it this is much the same process as trying to find node that turns out not to existas described in the section on find we follow the path from the root to the appropriate nodewhich will be the parent of the new node once this parent is foundthe new node is connected as its left or right childdepending on whether the new node' key is less than or greater than that of the parent