Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void goLeft() {
- if(!currentNode.isEmpty()) {
- stack.push(currentNode);
- currentNode = currentNode.left;
- }
- }
- public void goUp() {
- if(!stack.isEmpty()) {
- currentNode = stack.peek();
- stack.pop();
- }
- }
- public void goRoot() {
- do {
- currentNode = stack.peek();
- stack.pop();
- } while(!stack.isEmpty());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement