Binary Tree Inorder Traversal Visualizer & Step-by-Step Algorithm Solution

Visit binary tree nodes in Left -> Root -> Right order producing sorted order for Binary Search Trees.

Category: trees | Difficulty: Easy

Tags: DFS, Binary Tree, Inorder, BST

Binary Tree Inorder Traversal

4
2
1
3
7
6
9
100%
state
result[]
Initialization
1/38
Explanation

Start inorder traversal on binary tree with root: Node(4).

Source Code
1function inorder(node, result = []) {
2 if (!node) return result;
3 inorder(node.left, result); // Recurse Left
4 result.push(node.val); // Process Root
5 inorder(node.right, result); // Recurse Right
6 return result;
7}