void visit(Node *pRoot) { cout<<pRoot->value<<endl; } void LevelTraverse(Node *pRoot) { if (!pRoot) return; queue<Node *> q; q.push(pRoot); while (!q.empty()) { Node *pNode = q.front(); q.pop(); visit(pNode); if (pNode->pLeft) q.push(pNode->pLeft); if (pNode->pRight) q.push(pNode->pRight); } }
EOF