Morgan Stanley interview question

Write a method that can reverse a binary tree (mirroring).

Interview Answer

Anonymous

23 Feb 2014

recurse over each node: switching both left and rights of a node, and calling your function again on both child nodes (checking for nulls first)