Advertisement
Guest User

Untitled

a guest
Nov 15th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. public void goLeft() {
  2. if(!currentNode.isEmpty()) {
  3. stack.push(currentNode);
  4. currentNode = currentNode.left;
  5. }
  6. }
  7.  
  8. public void goUp() {
  9. if(!stack.isEmpty()) {
  10. currentNode = stack.peek();
  11. stack.pop();
  12. }
  13. }
  14.  
  15. public void goRoot() {
  16. do {
  17. currentNode = stack.peek();
  18. stack.pop();
  19. } while(!stack.isEmpty());
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement