next
operation, if we are not in the precomputed part of the tree, traverse to the next in-order node using the stack, pushing left children onto the stack until we reach the leftmost node.prev
operation, simply move the pointer back in the list of already visited nodes.hasNext
operation checks if there are any nodes left to visit or if we are not at the end of the precomputed list.hasPrev
operation checks if the pointer is greater than 0, indicating that there is a previous node in the precomputed list.