严氏北美IT公司面试真题汇总和解答论坛
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Binary Tree Upside Down

Go down

Binary Tree Upside Down Empty Binary Tree Upside Down

Post by Admin Sat Oct 21, 2017 4:11 pm

public BTreeNode UpsideDownBinaryTree(BTreeNode root) {
if (root == null)
return null;
BTreeNode parent = root, left = root.left, right = root.right;
if (left != null) {
BTreeNode ret = UpsideDownBinaryTree(left);
left.left = right;
left.right = parent;
return ret;
}
return root;
}

Admin
Admin

Posts : 124
Join date : 2017-10-21

https://csinterviewquestions.forumotion.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum