template<class T>
void BinTree<T>::Norecinorder(BinTreeNode<T>* t) const
{
if (t == NULL) return;
stack<BinTreeNode<T>*>s;
while (t!=NULL||!s.empty())
{
while (t != NULL)
{
s.push(t);
t = t->getleft();
}
if (s.empty()) return;
s.pop(t);
cout << t.data << endl;
t = t.right;
}
}
二叉树非递归中序遍历
最新推荐文章于 2021-09-17 18:01:56 发布