 Convert - Maple Help

Iterator[Trees]

 Convert
 convert between tree formats Calling Sequence Convert(tree,fin,fout) Parameters

 tree - Array; tree to convert fin - A,C,D,E,LR,P,S,Z; format of input fout - A,C,D,E,LR,P,S,Z; format of output Description

 • The Convert command converts one tree format to another.
 • The tree parameter is an Array corresponding to a tree format. It may consist of two Array, L and R, if the input format is LR.
 • The fin and fout parameters specify the input format and the desired output format. The symbols A, C, D, E, LR, P, S, Z specify each of the formats. See Iterator[Trees] for a description of each format. Examples

 > $\mathrm{with}\left(\mathrm{Iterator}:-\mathrm{Trees}\right):$

Generate a random tree, in LR format, with 10 internal nodes.

 > $L,R≔\mathrm{Random}\left(10,\mathrm{format}=\mathrm{LR}\right)$
 ${L}{,}{R}{≔}\left[\begin{array}{cccccccccc}{2}& {0}& {4}& {5}& {0}& {7}& {0}& {9}& {0}& {0}\end{array}\right]{,}\left[\begin{array}{cccccccccc}{10}& {3}& {0}& {6}& {0}& {0}& {8}& {0}& {0}& {0}\end{array}\right]$ (1)

Convert the two arrays to a tree in Z format.

 > $\mathrm{Convert}\left(L,R,'\mathrm{LR}','Z'\right)$
 $\left[\begin{array}{cccccccccc}{1}& {2}& {4}& {5}& {6}& {9}& {10}& {12}& {13}& {19}\end{array}\right]$ (2) Compatibility

 • The Iterator[Trees][Convert] command was introduced in Maple 2016.