Mirror a binary tree by swapping each node's left and right children.
Easy Explanation
Invert Binary Tree mirrors a tree by swapping the left and right child at every node.
Traversal
n/a
Visited
0
Swaps
0
Result
Inverting
Press Play or Step to start execution.
Original
empty
Current Frame
empty
Final Output
empty
function invertTree(node):
if node is null:
return null
swap node.left and node.right
invertTree(node.left)
invertTree(node.right)
return node