node newnode new node()/make new node newnode idata id/insert data newnode ddata ddif(root==null/no node in root root newnodeelse /root occupied node current root/start at root node parentwhile(true/(exits internallyparent currentif(id current idata/go leftcurrent current leftchildif(current =null/if end of the line/insert on left parent leftchild newnodereturn/end if go left else /or go rightcurrent current rightchildif(current =null/if end of the line /insert on right parent rightchild newnodereturn/end else go right /end while /end else not root /end insert(/we use new variableparent (the parent of current)to remember the last non-null node we encountered ( in the figurethis is necessary because current is set to null in the process of discovering that its previous value did not have an appropriate child if we didn' save parentwe' lose track of where we were to insert the new nodechange the appropriate child pointer in parent (the last non-null node you encounteredto point to the new node if you were looking unsuccessfully for parent' left childyou attach the new node as parent' left childif you were looking for its right childyou attach the new node as its right child in figure is attached as the left child of traversing the tree traversing tree means visiting each node in specified order this process is not as commonly used as findinginsertingand deleting nodes one reason for this is that