满意答案
kanxz1900
2013.04.26
采纳率:50% 等级:12
已帮助:9221人
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950#includestruct Bitree{ char c; struct Bitree *l; struct Bitree *r;};struct Bitree * create(){ char ch; struct Bitree *s; scanf("%c",&ch); if(ch=='#') return NULL; else { s=(struct Bitree *)malloc(sizeof(struct Bitree)); s->c=ch; s->l=create(); s->r=create(); return s; }}void preorder(struct Bitree *root){ if(root!=NULL) { printf("%c",root->c); preorder(root->l); preorder(root->r); }}void inorder(struct Bitree *root){ if(root!=NULL) { inorder(root->l); printf("%c",root->c); inorder(root->r); }}void lastorder(struct Bitree *root){ if(root!=NULL) { lastorder(root->l); lastorder(root->r); printf("%c",root->c); }}
00分享举报