the details of the refinement of the statement in italics can be found in the program presented below the average path length of , is now given by the quotient , / ,nand its root is the node with index , let us now describe the structure of the program to be designed its two main components are the procedures to find the optimal search treegiven weight distribution wand to display the tree given the indices firstthe counts and and the keys are read from an input source the keys are actually not involved in the computation of the tree structurethey are merely used in the subsequent display of the tree after printing the frequency statisticsthe program proceeds to compute the path length of the perfectly balanced treein passing also determining the roots of its subtrees thereafterthe average weighted path length is printed and the tree is displayed in the third partprocedure opttree is activated in order to compute the optimal search treethereafterthe tree is displayed and finallythe same procedures are used to compute and display the optimal tree considering the key frequencies onlyignoring the frequencies of non-keys to summarizethe following are the global constants and variablesconst (*max no of keywords*wordlen (*max keyword length*var keyarray + wordlen of charabarray + of integerpwrarray + + of integerprocedure baltree (ijinteger)integervar kresintegerbegin :( + + div [ij:kif > then res : else res :baltree(ik- baltree(kjw[ijendreturn res end baltreeprocedure computeopttree (ninteger)var xmintmpintegerijkhmintegerbegin (*argumentwresultspr*for : to do [ii: endfor : to - do : + [ij: [ij] [ij: endfor : to do for : to - do : +hm : [ij- ]min : [im- [mj]for : + to [ + jdo tmp : [ik- ] : [kjtmpif min then :kmin : end endp[ij:min [ij] [ij: end end end computeopttree(adens _opttree *