Write a C++ function to swap the left and right child of every node in a given binary tree. Each node of the tree is defined by
struct Node {
Node I, r;
int val;
};
A skeleton of the required recursive function is shown below. The main function calls check(root) where root is the root node.
void swap(Node *t){
// write your code here
}
struct Node {
Node I, r;
int val;
};
A skeleton of the required recursive function is shown below. The main function calls check(root) where root is the root node.
void swap(Node *t){
// write your code here
}