Home >Common Problem >What is the structure of a tree?

What is the structure of a tree?

藏色散人
藏色散人Original
2020-06-29 09:49:0518051browse

Tree is a very important and widely used nonlinear data structure. It is a structure in which data elements are organized according to branch relationships. Tree structures widely exist in the objective world, such as the genealogy of human society and various All social organizations can be represented by trees, and trees are also widely used in the computer field.

What is the structure of a tree?

#Tree is a very important and widely used nonlinear data structure.

Tree is an important nonlinear data structure. Intuitively, it is a structure in which data elements (called nodes in the tree) are organized according to branch relationships, much like those in nature. Trees like that.

Introduction

Tree structures widely exist in the objective world. For example, the genealogy of human society and various social organizations can be represented by tree images. Trees are also widely used in the computer field. For example, when compiling a source program as follows, a tree can be used to represent the grammatical structure of the source program as follows. Another example is that in database systems, tree structure is also one of the important organizational forms of information. All problems with hierarchical relationships can be described by trees.

Definition

A tree (tree) is a finite set composed of n (n>0) elements, where:

(1) Each element is called Node;

(2) There is a specific node, called the root node or root;

(3) Except for the root node, the remaining nodes It is divided into m (m>=0) disjoint finite sets, and each subset is a tree (called a subtree of the original tree)

The above is the detailed content of What is the structure of a tree?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn