public void RunBinaryTreeReverse() { int[] _array = new int[] { 1, 2, 3, 4, 5, 6, 7 }; TreeNode tree = new TreeNode(); tree = NodeLevel(_array, 0, tree); tree.Print(true); tree = BinaryTreeReverseIt(tree); Console.WriteLine("----end-----"); tree.Print(true); }
public void Print(bool doLine) { Console.Write("--------({0})----------", val); if (doLine) { Console.WriteLine(); } if (left != null) { bool pl = right == null; left.Print(pl); } if (right != null) { bool pl = ((right.left != null) || (right.right != null)); right.Print(pl); } }