boolisSymmetric2(TreeNode* root) { if (!root)returntrue; TreeNode* left = root->left; TreeNode* right = root->right; queue<TreeNode*> q; q.push(left); q.push(right); while (!q.empty()) { left = q.front(); q.pop(); right = q.front(); q.pop(); if (left == NULL && right == NULL)continue; if (left == NULL || right == NULL)returnfalse; if (left->val != right->val)returnfalse; q.push(left->left); q.push(right->right); q.push(left->right); q.push(right->left); } returntrue; }