keyintegerleftrightnode endvar rtexts readerwtexts writerrootnodeprocedure tree (ninteger)nodevar newnodexnlnrintegerbegin (*construct perfectly balanced tree with nodes*if then new :nil else nl : div nr : -nl- new(new)texts readint(rnew key)new key :xnew left :tree(nl)new right :tree(nrendreturn new end treeprocedure printtree (tnodehinteger)var iintegerbegin (*print tree with indentation *if nil then printtree( lefth+ )for : to do texts write(wtabendtexts writeint(wt key )texts writeln( )printtree( righth+ end end printtreeassumefor examplethe following input data for tree with nodes the call root :tree( reads the input dara while constructing the perfectly balanced tree shown in fig fig tree generated by preceding program note the simplicity and transparency of this program that is obtained through the use of recursive procedures it is obvious that recursive algorithms are particularly suitable when program is to manipulate information whose structure is itself defined recursively this is again manifested in the procedure which