How a tree is converted into a binary tree

Highlights:

From the root of the tree start from top to bottom, look at each node, you are looking at the child nodes on the left subtree, brothers on the right subtree.

Formulas:

1. Place the child nodes on the left subtree;

2. The node brother on the right sub-tree.

On this issue, the best way is to remember an example, because the language is not very good description, is not easy to understand description.

example:

 

 

 

Or there is another method for understanding:

step:

1. Add a connection between all the sibling nodes

2. For each node, in addition to its connection to retain the eldest, and remove the other child node connection.

As shown below:

----------------
Disclaimer: This article is CSDN blogger "Meng Meng cat" of the original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source and link this statement.
Original link: https: //blog.csdn.net/tjh625/article/details/87839191

Guess you like

Origin www.cnblogs.com/youknowUL/p/11546358.html