mirror of
https://github.com/TheAlgorithms/C
synced 2025-04-20 04:12:50 +03:00
14 lines
274 B
C
14 lines
274 B
C
struct TreeNode *invertTree(struct TreeNode *root)
|
|
{
|
|
struct TreeNode *tmp;
|
|
if (root == NULL)
|
|
return NULL;
|
|
tmp = root->left;
|
|
root->left = root->right;
|
|
root->right = tmp;
|
|
|
|
invertTree(root->left);
|
|
invertTree(root->right);
|
|
return root;
|
|
}
|