Data structure and algorithm analysis java--tree

Source: Internet
Author: User

1. Basic terminology

Degree (degree): The number of subtrees of a node is called the degree of the node, and the maximum node degree in the tree is called the degree of the tree.

Layer (Level): Count from root node, 1 for Root

Height/Depth (depth): Maximum number of layers for a node

2. Two Fork Tree nature

Full two fork tree:

Complete binary tree:

3. Storage structure of two-fork tree

1) Sequential storage structure

2) Chain-store

4. Two cross-tree traversal

1) Pre-sequence traversal: Kenzo Right sub-tree

2) Middle sequence traversal

3) Post-traversal

4) Hierarchical traversal: from top to bottom, from left to right

5. Conversion of number and two fork trees and storage structure of trees

1) The tree is transformed into a two-fork tree

2) binary tree restored to tree

3) Tree Traversal

1) Root traversal: the same as the pre-order traversal of the two-fork tree that it transforms

2) post-root traversal: the same as the middle-order traversal of its converted two-fork tree

Post-root traversal: Efbcgda F LMG H B NIC D jke A

6. The tree's storage structure

1) Parental chain notation

2) Child chain notation

3) Parent-child linked list

4) Kids Brother chain

Data structure and algorithm analysis java--tree

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.