Advanced Algorithm journal 5: two fork Tree

Source: Internet
Author: User
Author: Sun Xiang

E-mail: sunxiangguodut@qq.com

Directory

Author Sun Xiang Binary tree is very important 1 Analysis 2 knowledge Status 3 The basic concept and properties of the actual application Tree 1 tree Definition 2 tree representation of the logical representation of tree representations concave representation of the general table representation nested representation 3 The basic term of the tree node degree and the degree of the tree node leaf node child node parent node brother Brother node ordered tree and unordered tree have root tree and no root tree full m times tree path and path length study questions tree is not exactly the nature of the 4 Tree 5 tree Traversal store 6 exercises the basic concept and nature of the binary tree 1 nature non-empty binary tree complete binary tree full two fork Tree 2 storage 32 fork Tree tree Forest turn Change 4 exercises The basic algorithm of the binary tree 12 the traversal of the fork Tree Traversal sequence traversal 2 Create find height 32 fork tree construction theorem 4 exercises clue two fork Tree Huffman tree 1 Huffman tree structure 2 Properties 3 exercises

0. Two fork trees are important

Last two times of class review

DFS,BFS: Random Walk method 0.1 Analysis

"Test Target" understand the basic concept of data structure, grasp the logical structure, storage structure and its differences, and the implementation of various basic operations. Master the basic data processing principles and methods on the basis of the algorithm can be designed and analyzed. Be able to choose the appropriate data structure and methods for problem solving, and have the ability to design and implement algorithms in C or C + + languages.

Three, tree and two fork tree

(i) Basic concepts of trees

(ii) binary tree

  1. Definition of two-fork tree and its main features

  2. Two binary tree sequential storage structure and chained storage structure

  3. Traversal of two fork tree

  4. Basic concept and construction of clue two fork tree

(iii) Trees, forests

1. Tree storage Structure

2. Forest and two fork tree conversion

3. Tree and Forest traversal

(iv) Applications of trees and two-fork trees

1. Two fork sorting tree

  4. Balanced binary Tree

  5. Huffman (Huffman) tree and Huffman code
0.2 Knowledge Status 0.3 Practical Application

Applications in machine learning algorithms:

1, hierarchical Clustering (Zhou Zhihua 214)

2, decision Tree (Zhou Zhihua 73)

3,KNN and KD Tree

Application of network generation model: "Complex network theory and application" 175 page 1. Basic concepts and properties of trees 1.1 tree definition

A tree is a finite set of n N (n⩾0) (n\geqslant 0) nodes (recorded as T T). Wherein, if n=0 n=0, it is an empty tree; if n>0 n> 0, the N-N nodes have only one node as the root node of the tree, the remaining nodes can be divided into m (m⩾0) m (M \geqslant 0) disjoint finite set T1,t2,⋯,tm t_1, T_2,\cdots,t_m, where each sub-set itself is a tree that conforms to this definition and becomes a subtree of the root node.

This is the definition of benevolent and general counseling books. In fact, this definition, and no egg use. : Smile:

Here is the "definition" of the tree that Xiangguo for you to summarize:

A free tree (that is, a tree) is a connected, non-circular undirected graph.

Done, is not and elegant.

which

Any two vertices in the tree are connected by a unique simple path.

The tree is connected, but the graphs that are removed from any edge of the graph are not connected, and if any of the edges are added, the rings are formed and the number of edges is | v|−1 | V|-1.

The ultimate definition of a tree

If a non-simple graph G satisfies one of the following mutually equivalent conditions, then G is a tree:
G is a connected graph with no loops.
G does not have a loop, but adding any edge within G will form a loop.
G is connected, but if you remove any of the edges, you are no longer connected.
G is connected, and the full graph of the 3 vertex K3 K_3 is not a sub-graph of G.
Any two vertices within G can be connected by a unique path.
If there is a finite number of vertices (set to n vertices) for the non-trivial graph G, then g is a tree and is equivalent to:
G is connected, has n−1 edges, and G does not have a simple loop.
If there is no simple loop in a non-simple graph G, then G is the forest

There is only one path between each of the two points in a tree (a path that does not have a repeating edge). A tree with n points has a N-1 edge, which is the minimum number of sides required to connect n points. So if one side of the tree is removed, the tree will not connect.
If you add an arbitrary edge to a tree, you get a graph with a single ring. This is because there is only one path in the two points (or a point) that the edge connects to, and this path joins the newly added edges as a ring. If you delete all the extra edges in a connected graph, the tree is called the spanning tree of the graph.
If you want to add a point to the tree, add an edge that is connected to the original point. This side does not add a ring or extra path to this tree. So each time you add a point, you can make a tree.
A tree can be either a direction or a non-direction. Obviously, a tree is a connected graph, but not a double-connected graph (for undirected graphs) or a strongly connected graph (for a undirected graph). A tree can be considered a sparse graph.
Obviously there are no self-loops and repeating edges in the tree.

Since the beginning of the recursive definition of no eggs, why most textbooks have adopted this definition.

Don't worry, I'll tell you the answer later. 1.2 Logical representations of trees tree-shaped notation

Indentation notation

Generalized Table representation method

Also called parenthesis notation

(A (B (e,f,g), C (H), D (I,J))) (A (B (e,f,g), C (H), D (I,J))) nested notation

It's also called the notation of the venturi graph.

2. Concept and properties of two-fork tree 1.3 The basic terms of the tree the degree of the node and the degree of the tree

The number of subtrees of a node in a tree is called the degree of this node. The maximum number of degrees for each node in the tree is called the degree of the tree, which is usually called M M secondary tree.

Please note that. The degree of the vertex in the graph

In practice, we like to call a node under the category of a root tree, and the point under the category of the graph is called the vertex. branch node, leaf node, child node, parent node, sibling node

Slightly ordered tree and unordered tree

If the subtree of each node in a tree is arranged in a certain order from left to right, and the relative order is not arbitrarily transformed, it is called an ordered tree (some people also called the tree), otherwise called the unordered tree (some people also called the Non-tree). A tree in the usual sense refers to an unordered tree. There are a tree and no root tree

Specifies a node as the root, called a root tree.

There is no tree that specifies the root node, which is called a tree without root. Since no root tree has no root node, there is no way to calculate the hierarchy and height of the tree. A tree in the usual sense refers to a root tree. Full M-Time tree

If the root node and the leaf node, the degree of the other nodes are all M, and all the leaf nodes are on the same layer, such a tree is called full M-tree. For full M-trees with a height of H, the node number range is 1:mh−1m−1 1:\frac{m^h-1}{m-1} complete M-Tree

For a full M-tree with a height of H, following the sequence number of a full M-tree, the highest layer is continuously missing several nodes with the largest number, but at least one node in the highest layer, such a tree is called a full M-tree with a height of H. path and path length:

For any of two nodes ki,kj

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.