Learning data structure_4 _ tree (2) and fig (1)

Source: Internet
Author: User

Today, there are a lot of chores, and the learning time is relatively scattered, so the efficiency is not very high, and there is less content to read. In general, the data structure has been read for more than half over the past four days, there are three chapters left: graph, search, and sorting. We will try to end the data structure content in the next three days. The following is what we learned today.


Tree)

1. pre-order traversal algorithm: similar to binary tree definition, it adopts recursive form.

2. The traversal of the middle and back orders is similar to that of the front order implemented by recursion. The front, middle, and back represent the order in which the single recursive algorithm accesses the root node.

3. The known (front + middle) or (back + middle) sequential traversal sequence can uniquely identify a binary tree. A single known front + back cannot.

4. Extended Binary Tree: The child pointer of each node leads to a virtual node. The extended binary tree can be identified by a traversal sequence.

5. clue: pointer to the front and back; clue linked list: a binary linked list with clues; the corresponding binary tree is called a clue binary tree; flag domain: ltag and rtag: whether the lchild and rchild pointers point to the pre-and subsequent Boolean Flag Fields

6. node Structure: lchild + ltag + Data + rtag + rchild.

7. implementation of recursive functions with clues in the middle order traversal: If the left pointer of a node is null, p-> lchild = pre; if the forward pre of P has no right child, so that pre-> rchild = P.

8. traverse the binary tree after the clue is made, which is equivalent to operating a two-way linked list structure. Add a header node before the root node and connect it to the root node and the last node of the traversal through the left and right child pointers of the header node.

9. Transformation of trees, forests, and binary trees: it is processed by adding a line to the line. After conversion, the traversal of trees and forests can be fully implemented using the Traversal method of Binary Trees.

10. He/He Coding

The path length of a tree is the sum of the path lengths from the root to each node. The binary tree with the minimum length of the weighted path WPL is called the Heman tree (optimal binary tree ).

He has learned from his undergraduate course "information theory and coding", so he will not describe it. The core idea is that the longer the symbol is used, the shorter its encoding length.

Graph)

1. Definition: consists of vertex's finite and non-empty set V and edge set E, expressed as G (V, E ).

2. relationships between data elements in various data structures: Linear table elements are linear relationships, Tree nodes are hierarchical relationships, and graph vertex is edge (Network-like) relationships.

3. terms related to various graphs

Undirected edges (parentheses) and directed edges (angle brackets) (ARC arc); undirected graphs and Directed Graphs; if a points to B, A is the end of the arc, and B is the arc header; simple graph; undirected full graph: any two vertices have edges, and N vertices correspond to N * (n-1)/2 edges. Directed full graph: n vertices correspond to N * (n-1) edges, sparse graphs, and dense graphs;

Net: weighted graph; degree of undirected graph vertex: Number of edges connected to the vertex. The actual number of edges is half of the vertices. Degree of Directed Graph vertex: inbound + outbound, actual number of arcs = vertex inbound degree = vertex outbound degree and path length: number of top paths or arcs; simple path.

Connected Graph: any two vertices are connected. connected components: extremely large connected subgraphs in an undirected graph. Strongly Connected Graphs: any vertex pair in a directed graph has a bidirectional path. strongly connected components: A very large strongly connected subgraph in a directed graph; a spanning tree of a connected graph: A connected subgraph with n vertices, n-1 edges; a directed tree: there is just a directed graph with a vertex's inbound degree of 0; the rest of the vertex's inbound degree is 1; directed graph's directed forest: A directed tree composed of several directed 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.