- C++
学树的进来
- @ 2026-5-31 14:20:50
struct tree{ int data; tree lchild; tree rchild; }; void pre(tree bt){ if(bt){ cout<<bt.data<<endl; pre(bt.lchild); pre(bt.rchild); } } void in(tree bt){ if(bt){ in(bt.lchild); cout<<bt.data<<endl; in(bt.rchild); } } void post(tree bt){ if(bt){ post(bt.lchild); post(bt.rchild); cout<<bt.data<<endl; } }
0 条评论
目前还没有评论...