算法导论 练习题 10.4-3

来源:互联网 发布:linux 视频剪辑 编辑:程序博客网 时间:2024/05/18 00:50
void travWithStack(TNP1 head){SNptr s=initStack();push(s,head);TNP1 p=head;while(!stackEmpty(s) || p){while(p){push(s,p);p=p->left;}if(!stackEmpty(s)){p=pop(s);printf("%d ",p->key);p=p->right;}}}

0 0
原创粉丝点击