当前位置:网站首页>Traversal of binary tree

Traversal of binary tree

2022-06-21 07:29:00 Follow the road to the end

The traversal of binary tree starts from the root node , There are three traversal forms according to the order of data access : The former sequence traversal 、 In the sequence traversal 、 After the sequence traversal .

The order here represents the access order of the root node of the tree .

 

The former sequence traversal : Press The root node --> The left subtree --> Right subtree Traverse in sequence .

The previous traversal result of the above binary tree is :ABDGHECFI

In the sequence traversal : Press The left subtree --> The root node --> Right subtree Traverse in sequence .

The traversal result of the above binary tree is :GDHBEACIF

After the sequence traversal : Press The left subtree --> Right subtree --> The root node Traverse in sequence .

The traversal result of the above binary tree is :GHDEBIFCA

1

原网站

版权声明
本文为[Follow the road to the end]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202221515066717.html