Loading…
Loading…
Visits Left → Node → Right. On a binary search tree this yields the values in sorted order.
Inorder: Left → Node → Right (sorted order for a BST).
Output: []
1void inorder(Node node, List<Integer> out) {2 if (node == null) return;3 inorder(node.left, out);4 out.add(node.val);5 inorder(node.right, out);6}