标签:
leetcode 226 Invert Binary Tree
递归方法
/** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ struct TreeNode* invertTree(struct TreeNode* root) { if(root==NULL) return root; struct TreeNode* temp = invertTree(root->left); root->left = invertTree(root->right); root->right = temp; }
leetcode 226 Invert Binary Tree
标签:
原文地址:http://www.cnblogs.com/walker-lee/p/4887703.html