Introduction to Trees and Binary Trees (1)

1. Definition of tree

A tree is a finite set of n nodes. If n=0, it is called an empty tree. If n>0, it meets the following two conditions: there is and only one specific node called the root; the rest of the nodes can be Divided into m disjoint finite sets, t1, t2, t3

  1. Root node

  2. Node: data element

  3. The degree of the node: the number of subtrees owned by the node

  4. image.png

5. Tree degree: the maximum value of the degree of each node in the tree

6. The depth of the tree: the maximum level of nodes in the tree

7. Ordered tree: each subtree is ordered from left to right

8. Forest: is a collection of m (m>=0) disjoint trees

Two. Definition of Binary Tree

A binary tree is a set of n finite elements . The set is either empty or consists of an element called the root and two disjoint binary trees called the left subtree and the right subtree. There are Sequence tree. When the set is empty, the binary tree is called an empty binary tree. In a binary tree, an element is also called a node

Note: Binary trees are not ordered trees. Binary trees strictly distinguish between left and right subtrees! !

Guess you like

Origin blog.51cto.com/14961637/2675543