C++广度优先遍历使用队列进行记录,每次先左后右就能实现广度优先遍历。代码如下 class Solution { public: vector<int> PrintFromTopToBottom(TreeNode* root) { vector <int> res; queue<TreeNode*> que; if(root!=NULL) { que.push(root); res.push_back(root->val); } ...