Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

已知一个二叉树的前序遍历结果是(ACDEFHGB) ,中序遍历结果是(DECAHFBG),请问后续遍历结果是_____ #29

Open
waylau opened this issue Jul 22, 2020 · 0 comments

Comments

@waylau
Copy link
Owner

waylau commented Jul 22, 2020

已知一个二叉树的前序遍历结果是(ACDEFHGB) ,中序遍历结果是(DECAHFBG),请问后续遍历结果是_____(2分)

A. HGFEDCBA
B. EDCHBGFA
C. BGFHEDCA
D. EDCBGHFA
E. BEGHDFCA
F. BGHFEDCA

你的回答C ,是错误的。应是B

由前序遍历可知根为A,并不能排除,继续看题。
由中序遍历可知左子树为DEC,由前序遍历可知【根-左-右】,后续为【左-右-根】,中序为【左-根-右】
所以所求后序左子树必定也只是DEC,只是顺序不同,所以选EDCHBGFA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant