C++ BFS
\nclass Solution {\npublic:\n    vector<vector<int>> zigzagLevelOrder(TreeNode* root) {\n        vector<vector<int>> ans;\n        if(root == NULL)\n           
```\nclass Solution {\npublic:\n    vector<vector<int>> zigzagLevelOrder(TreeNode* root) {\n        vector<vector<int>> ans;\n        if(root == NULL)\n            return ans;\n        queue<TreeNode*> info;\n        info.push(root);\n        bool flag = false;\n        while(!info.empty()){\n            int n = info.size();\n            vector<int> inter;\n            for(; n>0; n--){\n                TreeNode* top = info.front();\n                info.pop();\n                if(top->left != NULL)\n                    info.push(top->left);\n                if(top->right != NULL)\n                    info.push(top->right);\n                inter.push_back(top->val);\n            }\n            if(flag)\n                reverse(inter.begin(), inter.end());\n            ans.push_back(inter);\n            flag = !flag;\n        }\n        return ans;\n    }\n};\n```
['Breadth-First Search', 'C']