Creation of a data structure tree (first Order + middle order)

Source: Internet
Author: User
/* The result of the tree ordinal traversal is derived from the first order traversal and the middle order traversal: a d e B c F sequence traversal result is: D e A c F B Derivation process step 1: From the first sequence traversal to determine the root node is a, according to the central sequence traversal determines the root node of the Saozi right subtree so D e is the root node of the left subtree, C F B is the root node of the right Subtree Step 2: Determine the two children of root Node A by the first order traversal D B according to the sequence traversal to determine D for Zuozi B is the right subtree recursive step in the order of the result E is the right side of D, then the right of D is obtained E is the  root node  c F on the left of B is the  C F is Zuozi According to the first order traversal C is the root node according to the middle order traversal results F on the right  F C is the right subtree of c * /

Creation of a data structure tree (first Order + middle 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.