Data structure Learning--basic classification of Trees

Source: Internet
Author: User

Self-study data structure has been a long time, the use of textbooks is "data structure and algorithm analysis--c language description." Now look back and read the book again and comb the knowledge of the data structure.

Here is a basic classification of some of the trees from Wikipedia:

    • Unordered tree: There is no sequential relationship between the child nodes of any node in the tree, which is called the unordered tree, also known as the free tree;
    • Ordered tree: There is a sequential relationship between the child nodes of any node in the tree, which is called ordered tree;
      • Binary tree : A tree with a maximum of two subtrees per node is called a binary tree;
        • Complete binary tree: For a binary tree, suppose its depth is D (d>1). In addition to layer D, the number of nodes in each of the other layers has reached the maximum, and all nodes of layer d are continuously arranged from left to right, so that the two-fork tree is called a complete binary tree;
        • Full two fork tree: for the above-mentioned complete binary tree, if you remove all nodes of the D layer, then the remaining part will constitute a full two-fork tree (at this time the depth of the two-fork tree is d-1);
      • Hoffman: The shortest two-fork tree with the right path is called Huffman tree or optimal binary tree;
      • B-Tree
here are the basic concepts of some of the trees that are covered in the book:

expression tree : Leaves are operands, as usual, or variables. The other nodes are operators.

two fork Find tree : For each node in the tree x, all key values in its left subtree are less than the keyword value of x, and all the key values in its right subtree are greater than the key value of X.

AVL tree : The height of the Saozi right subtree for each node is up to 1 of the two fork lookup tree.

Stretch Tree : it guarantees that the operation of any successive M-times from an empty tree takes up to an O (M*logn) time.

b -Tree (quoted from Baidu Encyclopedia): A M-order (balanced tree of order m) is a balanced m-Path search tree. It is either an empty tree or a tree that satisfies the following properties:

1. The root node has at least two children; 2, each non-root node contains the number of keywords J satisfies: ┌m/2┐-1 <= J <= m-1;3, all nodes outside the root node (excluding leaf nodes) is exactly the number of keywords plus 1, so Inner subtreeThe number k satisfies: ┌m/2┐<= K <= m; 4, all leaf nodes are located on the same floor.(Knowledge points: Three kinds of tree traversal way-First order traversal, middle sequence traversal, post-order traversal)
Note:┌m/2┐ is the rounding up, that is, the result is the nearest to the result of the larger than the integer, ┌3/2┐=2;
└m/2┘ is an integer that is rounded down, that is, the nearest to the result, which is smaller than the result, └3/2┘=1.

trie Tree : also called word Search tree, dictionary tree. the root node does not contain characters, and each node outside the root node contains only one character, and a string corresponding to that node is concatenated from the root node to a node, and all child nodes of each node contain different characters. (Learned in the Brush ACM topic)

A simple summary of three ways to traverse a tree:

Ordinal traversal (prefix expression): Print Order: node, Zuozi, right subtree.

Mid-sequence traversal (infix expression): Print order: Zuozi, node, right subtree.

Post-order traversal (suffix expression): Printing sequence: Zuozi, right subtree, node.





Data structure Learning--basic classification of Trees

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.