```cpp
#include
using namespace std;

int k;

struct Tree {
int left,right;
}myTree[17];

void qianxu(int q) {
//root -> leftson -> rightson
if(q) {
cout< qianxu(myTree[q].left);
qianxu(myTree[q].right);
}
}

void zhongxu(int z) {
//leftson -> root -> rightson
if(z) {
zhongxu(myTree[z].left);
cout< zhongxu(myTree[z].right);
}
}

void houxu(int h) {
//leftson -> rightson -> root
if(h) {
houxu(myTree[h].left);
houxu(myTree[h].right);
cout< }
}

int main() {
cin>>k;
for(int i=1;i<=k;i++) {
cin>>myTree[i].left>>myTree[i].right;
}

qianxu(1);
cout< zhongxu(1);
cout< houxu(1);

return 0;
}
```

Last modification:August 3, 2016
博客维护不易,如果你觉得我的文章有用,请随意赞赏