Trịnh Quốc Lâm
New member
How will you find the maximum element in a binary search tree?
A.
B.
C.
D.
A.
Code:
public void max(Tree root)
{
while(root.left() != null)
{
root = root.left();
}
System.out.println(root.data());
}
Code:
public void max(Tree root)
{
while(root != null)
{
root = root.left();
}
System.out.println(root.data());
}
Code:
public void max(Tree root)
{
while(root.right() != null)
{
root = root.right();
}
System.out.println(root.data());
}
Code:
public void max(Tree root)
{
while(root != null)
{
root = root.right();
}
System.out.println(root.data());
}