Binary Tree Inorder Traversal
easyTime: O(n)Space: O(n)
Signals to notice
visit all nodesleft-right-root or root-left-right ordertree traversal
Brute force first
No brute force alternative — traversal is the task itself. It is a fair place to begin because it matches the surface of the question, yet it does not capture the deeper structure that makes the problem simpler.
The key insight
Recursive DFS: traverse left subtree, visit node, traverse right subtree. Instead of recomputing the world every time, you preserve just enough context to let the next decision become obvious.
What must stay true
Inorder traversal of a BST visits nodes in sorted order. As long as that statement keeps holding, you can trust the steps built on top of it.
Easy way to go wrong
Forgetting the base case (null node) — always check if the node exists before recursing. The fix is usually to return to the meaning of each move, not just the steps themselves.