DEV Community

Discussion on: A Visual Guide to How to Actually Invert a Binary Tree

Collapse
 
pentacular profile image
pentacular • Edited

You have two branches -- say 'left' and 'right'.

Instead of modifying the tree you can modify how you traverse it.

Where you would choose 'left', instead choose 'right'.
Where you would choose 'right', instead choose 'left'.

Thread Thread
 
jacobjzhang profile image
Jake Z.

Ah gotcha, yes!