# Include <iostream> using namespace STD; const int maxsize = 20; // The maximum size of the array int P; // a temporary number is used to mark the position of the array in the current operation char midorder [maxsize]; // used to store the char preorder [maxsize] array in the sequential traversal order; // used to store arrays in the first traversal order // initialization method void Init () {cout <"in-order:"; CIN> midorder; cout <"pre-order:"; CIN> preorder; cout <"post-order:"; P = 0 ;} // recursively output the post-order traversal method void find (char mid [maxsize]) {int Q; char temp [maxsize]; If (mid [0] = NULL) return; for (INT I = 0; m Id [I]! = '\ 0'; I ++) {If (mid [I] = preorder [p]) {q = I; // obtain the Q // that is, the Q-th Column in the current array is the root node} for (I = 0; I <q; I ++) {temp [I] = mid [I]; // Save the node before the root node to the T array} temp [Q] = '\ 0 '; // mark the end of the string P ++; find (temp); // continue the subtree before the root node for (I = q + 1; mid [I]! = '\ 0'; I ++) // pass the node back to the temp array temp [i-q-1] = mid [I]; temp [strlen (MID) -1-Q] = '\ 0'; // Add \ 0 to the end of the string. Find (temp ); // The subtree after the root node continues to traverse cout in the descending order <mid [Q]; // Finally, return;} void main () {Init (); find (midorder); cout <Endl ;}