Data structure Practice project--tree and two-fork tree (2)

Source: Internet
Author: User

This article is for the basic Data Structure series (6): Tree and two tree 7th, 11-15 hours

72 cross-tree and tree, forest conversion
112 cross-tree traversal non-recursive algorithm
12 Hierarchical Traversal algorithm
132 structure of the fork tree
14 Clue two fork Tree
15 Huffman Tree

"Project 1-two cross-tree algorithm validation"

Run and repeat the algorithms involved in the test teaching content. The significance of changing test data for repeated testing is that the algorithm can be realized from more angles to achieve the degree of mastering the algorithm gradually. Use your test data and show the results of the test to see the results of the operation to understand the algorithm.
(1) Verification of hierarchical traversal algorithm [reference link]
(2) Verification of binary tree construction algorithm [reference link]
(3) algorithm verification of Middle sequence clue binary tree [reference link]
(4) Huffman coding algorithm Verification [reference link]

"Item 2-solving algebraic expressions with binary trees"

Using a binary tree to represent algebraic expressions, each branch node of the tree represents an operator, and each leaf node represents an operand (for simplification, only two mesh is supported for the + 、-、 *,/, no parentheses, and the operand is just one digit character. This project only considers the entry in accordance with the above rules). Please design the algorithm, (1) According to the shape such as " 1+2?3?4/5 The string represents the expression, constructs the corresponding two-tree (), uses the thought of the post-order traversal to calculate the value of the expression, can reflect the first multiplication after the addition and subtraction of the rule, (2) to the construction of the two-fork tree, the expression value is calculated.
  
Please use the binary Tree algorithm library.
[Reference Solution]

On paper: "Knowledge principle" test questions

0607 has a forest f={t1, T2, T3}, as shown, please draw the corresponding two-fork tree, and then try to restore to the forest.

0613 Two fork tree structure: it is known that a binary tree is listed as CBEDAHGIJF, and the order sequence is CEDBHJIGFA, please give the tree representation of the two-fork tree.

0614 Clue two fork tree: Draw a post-threaded tree of the following two-fork trees.

0615 Huffman tree: The following table gives the frequency of words appearing in a text file. Assuming that only these words in the text file, please give the Huffman code of each word, find the average search length.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Data structure Practice project--tree and two-fork tree (2)

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.