Java, how do i flip a binary tree?
EX:
Input:
4
/
2 7
/ /
1 3 6 9
Output:
4
/
7 2
/ /
9 6 3 1
Solution
`Hey,
Note: Brother in case of any queries, just comment inbox I would be very happy to assist all your queries
In the flip operation, left most node becomes the root offlipped tree and its parent become its right child and the rightsibling become its left child and same should be done for all leftmost nodes recursively.
Below is main rotation code of a subtree
root->left->left = root->right;
OR
OR