Rebuilding a binary tree in the middle and back order

Source: Internet
Author: User
Binary Tree depth Time Limit: 1000 ms memory limit: 65536 k any questions? Click Here ^_^ Description

The central and post-order traversal sequences of a binary tree are known to evaluate the depth of the binary tree.

Input

There are multiple groups of input data.T, Indicates thatTGroup data. Each group of data contains two data types with a length less50The first string represents the central traversal of the binary tree, and the second represents the post-sequential traversal of the binary tree.

Output the depth of the binary tree. Sample Input
2 dbgeafcdgebfcalnixulinux
Sample output

4

3

Come on .. Employees are not afraid of difficulties

 

Rebuilding a binary tree in the middle and back order

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.