Everything about the data structure of the tree

When you first learn coding, most people are with the array as the main data structure to learn.

After that, you will learn to hash table. If you are a computer professional, you definitely need elective courses a data structure. In class, you will learn such as linked lists, queues, and stack data structure. These are collectively referred to as a linear data structure, because they have start and end points logically.

When you start to learn the tree graph and data structures, you will feel it is so confusing. Because of its storage is not linear, they have their own particular way of storing data.

definition

Tree is a well-known non-linear data structure. They do not store data in a linear manner. They organize data hierarchically.

Definition of the tree

Tree (  tree) is called node (  nodecollection of entities) is. By an edge node (  edgeconnection). Each node contains a value or data (  ), and each junction node may or may not have a child node.value/date

The first node in the tree is called the root node (ie  rootnode). If the root node and other connected nodes, the root node is the parent (  parent nodewith the root node is a child node connected to the (  child node).

All nodes through edges (  edgeconnected). It is important to have a concept tree, because it is responsible for managing the relationship between the nodes.

Leaf node (  leaves) is the end of the tree, they have no child nodes. Like a real tree, we can see that the trees have roots, branches and leaves.

Tree height (  height) and depth (  depth)

  • It is the height of the tree to a leaf node (end of the tree) length

  • Depth node is the root node to its length

GLOSSARY OF TERMS 

  • The root of the tree is the top-most node

  • Edge is a connection between two nodes

  • A child node having a parent node of the node

  • It is a parent node has a child node connected to node

  • Leaf node is the node has no child nodes in the tree (tree ending in)

  • Height is the length of the tree to leaf nodes (tree obtained terminus)

  • Depth is the length of the root node to node

Guess you like

Origin www.cnblogs.com/xiaozhongfeixiang/p/11571725.html