作者koehie (開喜烏龍茶)
看板Grad-ProbAsk
標題[理工] [資結] 前後序求中序
時間Sat Jan 29 16:51:29 2011
請問下面這一題(99成大電機)是否有辦法求出唯一解 ?
Assume the preorder t raversal of a binary tree is "L, J, B, A, C, G, D, E, K,
I, F, H" and the postorder traversal of the same tree is "A, C, B, D, E, G, J
F, H, I, K, L". Also, assume that the subtree with J as root is a full binary
tree and J is the root of L's left subtree. Hence, K is the root of L's right
subtree and I the root of K's right subtree. Will you be able to uniquely
define the tree ? If yes, please draw the binary tree. If no, please indicate
how many distinct binary trees can be derived.
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.233.169.131
→ aerystyle:我求出的解有兩種可能,差別在於最後的F.H.I的所在位子 02/05 22:33
→ aerystyle:LJLBGI" "ACDEFH(F.H.I在左子樹,""代表空格) 02/05 22:35
→ aerystyle:LJLBG" "IACDE" "" "FH(F.H.I在右子樹,""代表空格) 02/05 22:36
→ aerystyle:有問題在寄站內信討論吧 02/05 22:36