salem99
07-07-2004, 12:15 PM
hi
i have a problem with do while in this code
public int find (int value)
{
int counter = 0;
Node tempNode = root;
do {
counter++;
if (value == tempNode.getValue() )
{
this.current = tempNode;
return counter;
}
else if (value < tempNode.getValue() )
{
tempNode = tempNode.getLeft();
//this.current = tempNode;
}
else
{
tempNode = tempNode.getRight();
//this.current = tempNode;
}
}
//current = null;
return -1 * counter;
} while (tempNode != null);
its not running and i am confused where is the problem here.
thanx
i have a problem with do while in this code
public int find (int value)
{
int counter = 0;
Node tempNode = root;
do {
counter++;
if (value == tempNode.getValue() )
{
this.current = tempNode;
return counter;
}
else if (value < tempNode.getValue() )
{
tempNode = tempNode.getLeft();
//this.current = tempNode;
}
else
{
tempNode = tempNode.getRight();
//this.current = tempNode;
}
}
//current = null;
return -1 * counter;
} while (tempNode != null);
its not running and i am confused where is the problem here.
thanx