Hi everyone.
I am implemmenting an avl tree in java.
I use a Stack to store the path of inserting a new node.
I use it then as a parameter in a method like this:
public void update(Stack<Node> path)
{
Stack<Node> temp = path;
while(!temp.isEmpty())
{
Node node = temp.pop();
node.height = height(node);
updateRank(node);
}
}
After the excecution, my path is empty.
Shouldn't it be just the temp empty?
I also tryed declaring the temp path before calling the method and using the temp as a parameter for the method.
Same thing happened. After the excecution, my path is empty.
Can anyone help me, please?
Please excuse my bad English.
It looks like you're new here. If you want to get involved, click one of these buttons!