Java Reference
In-Depth Information
Display 15.39
A Binary Tree
root
40
20
50
null
10
30
60
null
null
null
null
null
null
left subtree
right subtree
1
public
class
IntTree
2{
3
public
class
IntTreeNode
4
{
5
private
int
data;
6
private
IntTreeNode leftLink;
7
private
IntTreeNode rightLink;
8
}
//End of IntTreeNode inner class
9
private
IntTreeNode root;
<
The methods and other inner classes are not shown.
>
10
}
You obtain a number of variants on this search process by varying the order of these
three steps. Two more versions follow:
inorder
Inorder Processing
1. Process the left subtree.
2. Process the data in the root node.
3. Process the right subtree.