首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

还有哪里不对,改了半天,该如何处理

2012-06-11 
还有哪里不对,改了半天C/C++ code[codeC/C++]//前序s.push(root)while(!s.empty()){roots.top()visit(

还有哪里不对,改了半天

C/C++ code
[code=C/C++]//前序s.push(root);while(!s.empty()){root=s.top();visit(root);if(root->left)s.push(root->left);else         //将右子树搞进去{if(root->right)s.push(root->right);else        // 右子树为空,把根弹出s.pop();}}//中序s.push(root);while(!s.empty()){root=s.top();if(root->left)s.push(root->left);elsevisit(root);//右子树if(root->right)s.push(root->right);else{s.pop();}}//后序s.push(root);while(! s.empty()){root=s.top();if(root->left)s.push(root->left);if(root->right)s.push(root->right);else{visit(root);s.pop();}}}}



代码不长, 谢绝粘贴代码,我要代码的话,可以网上找,很多的

我想知道哪里错了,如何改进。

高手们帮忙看看,




[/code]

[解决办法]
探讨

晕, 那我的到底对不对啊,


郁闷死了

热点排行