思路:
根节点入队列,取队头,左子树入队列,右子树入队列,访问队头
void _Level(Node* pRoot)
{
if(NULL ==pRoot)//根节点为空,返回
return;
queue<Node*> q;
q.push(pRoot);
while(!q.empty())
{
Node* pCur=q.front();
if(pCur->_pLeft)
q.push(pCur->_pLeft);
if(pCur->_pRight)
q.push(pCur->_pRight);
cout<<pCur->_value<<" ";
q.pop();
}
}