标签:turn nod esc int start cto item while title queue
vector<vector<int> > Print(TreeNode* pRoot) {
vector<vector<int> > vec;
if(pRoot == NULL) return vec;
queue<TreeNode*> q;
q.push(pRoot);
while(!q.empty())
{
int start = 0, end = q.size();
vector<int> c;
while(start++ < end)
{
TreeNode *t = q.front();
q.pop();
c.push_back(t->val);
if(t->left) q.push(t->left);
if(t->right) q.push(t->right);
}
vec.push_back(c);
}
return vec;
}
标签:turn nod esc int start cto item while title queue
原文地址:https://www.cnblogs.com/trouble-easy/p/12988482.html