Binary search tree traversal is divided into two categories, depth-first traversal and sequence traversal.
There are three types of depth-first traversal: pre-order traversal (preorder tree walk), mid-order traversal (inorder tree walk), and post-order traversal (postorder tree walk). They are:
1、前序遍历: First visit the current node, and then recursively access the left and right subtrees.
2、中序遍历 First recursively visit the left subtree, then visit itself, and then recursively visit the right subtree.
3、后序遍历 Recursively visit the left and right subtrees first, and then access your own nodes
The result of preorder traversal is shown as follows:

Corresponding code example:
...
// 对以node为根的二叉搜索树进行前序遍历, 递归算法
private void preOrder(Node node){
if( node != null ){
System.out.println(node.key);
preOrder(node.left);
preOrder(node.right);
}
}
...
The traversal result in the middle order is shown as follows:

Corresponding code example:
...
// 对以node为根的二叉搜索树进行中序遍历, 递归算法
private void inOrder(Node node){
if( node != null ){
inOrder(node.left);
System.out.println(node.key);
inOrder(node.right);
}
}
...
The result of traversing in the following order is shown:

Corresponding code example:
...
// 对以node为根的二叉搜索树进行后序遍历, 递归算法
private void postOrder(Node node){
if( node != null ){
postOrder(node.left);
postOrder(node.right);
System.out.println(node.key);
}
}
...
5.18.1. Java instance code ¶
源码包下载: Download
In recent years, Geographic Information Systems (GIS) have undergone rapid development in both theoretical and practical dimensions. GIS has been widely applied for modeling and decision-making support across various fields such as urban management, regional planning, and environmental remediation, establishing geographic information as a vital component of the information era. The introduction of the “Digital Earth” concept has further accelerated the advancement of GIS, which serves as its technical foundation. Concurrently, scholars have been dedicated to theoretical research in areas like spatial cognition, spatial data uncertainty, and the formalization of spatial relationships. This reflects the dual nature of GIS as both an applied technology and an academic discipline, with the two aspects forming a mutually reinforcing cycle of progress. Src/runoob/binary/Traverse.java file code: ¶
package runoob.binary;
/*\*
\* 优先遍历
*/
public class Traverse
Principles, Technologies, and Methods of Geographic Information Systems
102