Home > Common Problem > How many basic forms does a binary tree have?

How many basic forms does a binary tree have?

烟雨青岚
Release: 2020-06-29 09:17:07
Original
25110 people have browsed it

There are five basic forms of binary trees, namely: 1. Empty binary tree; 2. Binary tree with only one root node; 3. Only left subtree; 4. Only right subtree; 5. Complete binary tree.

How many basic forms does a binary tree have?

There are five basic forms of binary trees

1) Empty binary tree: Empty tree;

2) A binary tree with only one root node: a tree with only a root, that is, a single node;

3) Only a left subtree: a root and a left subtree;

4) Only right subtree: has root and has a right subtree;

5) Complete binary tree: has root and has a left subtree and a right subtree.

Special types:

1. Full binary tree: If a binary tree has only nodes with degree 0 and nodes with degree 2, and degree is 0 If the nodes are on the same level, the binary tree is a full binary tree.

2. Complete binary tree: a binary tree with a depth of k and n nodes if and only if each of its nodes is related to a full binary tree with a depth of k and n nodes. The numbers in the tree are from 1 to When n nodes correspond one to one, it is called a complete binary tree.

The characteristic of a complete binary tree is that leaf nodes can only appear on the two levels with the largest order, and the maximum order of descendants under the left branch of a node is equal to the maximum order of descendants under the right branch. or greater than 1.

Binary tree is an important type of tree structure. The data structures abstracted from many practical problems are often in the form of binary trees. Even ordinary trees can be easily converted into binary trees. Moreover, the storage structure and algorithm of binary trees are relatively simple, so binary trees are particularly important. The characteristic of a binary tree is that each node can only have two subtrees at most, and they can be divided into left and right subtrees.

A binary tree is a set of n finite elements. The set is either empty or consists of one element called the root and two disjoint elements, called the left subtree and the right subtree respectively. It is composed of a binary tree and is an ordered 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

For more related knowledge, please visit PHP Chinese website! !

The above is the detailed content of How many basic forms does a binary tree have?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template