This article begins with a discussion of some simple concepts and algorithms for the "tree".
Tree is a basic data structure, the reason is called the tree is derived from the bionic-branch bifurcation structure or the structure of the root fork, it is very good to express the logical relationship between the nodes, it is also a very important structure of graph theory. From the point of view of its name, we find that much of the growth of scientific thinking stems from a keen observation of nature, which provides a very good method for researchers.
We observe the tree structure of nature, it is easy to find that no tree of two branches grow together, and the abstract tree structure is so, from the root node, a path farther and deeper, there is no loop, based on this nature, we can push out many other characteristics of the tree.
1. Each of the two nodes in a tree has and only one path is connected. (Obviously, if this is not the case, it will produce a loop)
2. If a tree has n nodes, it happens to have n-1 edges.
3. Adding an edge to a tree will form a loop.
Tree-based abstract model, we actually use this structure in all aspects of life, such as the genetic pedigree of the organism, the organization composition of the company, the catalogue of books, the Match of the World Cup football team, etc., through this basic data structure, we can make the life of a lot of messy data organized, logical and form a system, This is the abstraction of things to our real life brought about by the traversal, but also our scientific knowledge of the original intention.
"Aha algorithm"--tree