Binary tree data structure

A binary tree consists of an empty tree, or a root node plus two disjoint binary trees called the left subtree and the right subtree.


 

 


Full binary tree: If in a binary tree, all its nodes are either leaf nodes, or the left and right subtrees are not empty, and all leaf nodes are on the same level, then the binary tree is called full binary tree,


 


Complete binary tree: If in a binary tree with n nodes, its logical structure is the same as the logical structure of the first n nodes of the full binary tree, then such a binary tree is called a complete binary tree

 



 and also single-branch trees


 


The binary tree traversal method usually has first root, middle root and back root. The following are examples of the three traversal methods.


 



 

 

 


And there is also a binary tree traversal method


 


 


 

Guess you like

Origin blog.csdn.net/weixin_69218754/article/details/131077337