Article Directory
Sequential storage representation
Data storage is an integer, for example.
// 二叉树的最大节点数
# define MAX_TREE_SIZE 100
//0号单元存储根节点
typedef int SqBiTree[MAX_TREE_SIZE];
SqBiTree bt;
A logical binary tree structure is as follows:
It sequentially stores the following structure:
As the binary tree is not necessarily a complete binary tree, so I hope to visit parent and sibling, child node numbers, then you must add the virtual node of the tree. From the above disadvantages of storage structure can be seen to do so is to have a lot of storage space is wasted.
So are generally binary tree structures for storing the chain.
Chain stores a
Binary list
Logical structure:
Node structure:
Trigeminal list
Logical structure:
Node structure:
If a binary tree containing nodes, then it must contain the binary list in pointers domain must empty chain domain.
prove:
The number of branches , i.e., there is non-empty chain domain th, it is equal to the empty chain domain Ge.