top of page

How to Reverse (or mirror) a Binary Tree in C#

Reversing a binary tree is so easy that even Joe Rogan can do it!

It's one of those questions that is asked a lot in a job interview because senior developers want to see how you work your way through the problem.

Just follow the algorithm: RE-BESIE.

RE - Write the REverse Method

B - If both the left node and right node are null, return.

E - Else

S - Swap the nodes

I - If the left node is not null, send the left node to reverse.

E - Else - Send the right node to reverse

And that's it! That's all you have to do. The code for this can be found at:


Search By Tags
No tags yet.
Follow Us
  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square
bottom of page