2 things that i dont understand:
class BTree{
private Node head;
public void add(int info){
Node node=new Node(info);
if(head==null){
head=node;
return;
}
Node current=head;
while (true) { // what does this mean? where is the true value derived from?
if(info<current.info){// to what number does the current.info refers to?
if (current.left==null) {
current.left=node;// i dont get this? why does it have to equal to node?
return;
}
else
current = current.left;
}
else {
if(info>current.info){
if (current.right==null) {
current.right=node;
return;
}
else
current = current.right;
}
}
}
}
thats part of an algorithm that creates a binary tree. the things that i dont understand are mentioned in the code