-->
当前位置:首页 > 题库

PROGRAMMING:Restore binary tree

Luz5年前 (2021-05-10)题库546
Given the preorder traversal sequence and middle order traversal sequence of a binary tree, it is required to calculate the height of the binary tree.
###Input format:
Input first gives a positive integer n ($$$Le $$50), which is the total number of nodes in the tree. The following two lines show the preorder and middle order traversal sequences, both of which are n-length strings that do not contain repeated English letters (case sensitive).
###Output format:
The output is an integer, that is, the height of the binary tree.
###Input example:
```in
nine
ABDFGHIEC
FDHGIBEAC
```
###Output example:
```out
five
```






answer:If there is no answer, please comment