It is known that the sequence sequence of the binary tree is DBGEAFC, and the order is DGEBFCA, and the corresponding two-fork tree is given.

Source: Internet
Author: User

How do we deal with this problem?

Write a data structure question today. Found a problem that always ran into problems here I wrote a solution I call it a hierarchical recursive solution.

The first step is to observe that we know the last one is the root node A

The left side of a in the middle sequence sequence is the right subtree to the right of the left child tree.

The second step is to draw the first layer to the right subtree of the root node as A-c-f

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvc29uz2p1bnlhbg==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast ">

Step three split Zuozi

In the sequence of DBGE (because we do not know the tree structure in the left dial hand tree can not be seen directly in the left sub-tree separately to see) in the order sequence for the Dgeb

The fifth step is to imitate the first step and the second step to draw

This time we can get the structure of Zuozi such as the following:

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvc29uz2p1bnlhbg==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast ">

It is known that the sequence sequence of the binary tree is DBGEAFC, and the order is DGEBFCA, and the corresponding two-fork tree is given.

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.