标签:
void print_by_level_2(treeNode* Root) { if(! Root) return; deque<treeNode*> dequeTreeRoot; dequeTreeRoot.push_back(Root); while(!dequeTreeRoot.empty()) { treeNode *temp = dequeTreeRoot.front(); dequeTreeRoot.pop_front(); cout << temp->data << " "; if (temp->lchild) dequeTreeNode.push_back(temp->lchild); if (temp->rchild) dequeTreeNode.push_back(temp->rchild); }//end while }
标签:
原文地址:http://www.cnblogs.com/Lunais/p/5933145.html