Inorder Traversal

An interactive, step-by-step visualisation of Inorder Traversal.

Category
Trees
Time complexity
O(n)
Space complexity
O(h)

Pseudocode

inorder(t):
  inorder(t.left)
  visit(t)
  inorder(t.right)

Reference implementation

def inorder(t, out):
    if not t: return
    inorder(t.l, out); out.append(t.v); inorder(t.r, out)

Open the interactive Inorder Traversal visualisation →