Leetcode Problem 94. Binary Tree Inorder Traversal
94. Binary Tree Inorder Traversal
Leetcode Solutions
Iterative Inorder Traversal Using Stack
Initialize an empty stack.
Initialize a pointer to the root node.
While the stack is not empty or the pointer is not null:
a. If the pointer is not null, push it onto the stack and move to its left child.
b. If the pointer is null, pop a node from the stack, add its value to the result list, and move to its right child.
Return the result list containing the inorder traversal.