[理工] [資結]-交大95-工工
Find all binary trees whose nodes appear in exactly the same sequence in both
(1) preorder and inorder
(2) preorder and postorder
(3) inorder and postorder
ans:
1. 空tree, Root 1個點, 右歪斜的二元樹
2. 空tree, Root 1個點
3. 空tree, Root 1個點, 左歪斜的二元樹
我看不懂解答的意思 我想法是
2.給前序跟後序無法決定唯一的B.T -->OK
1.給前序跟中序可以決定唯一的B.T,但為什麼說是空的樹呢,
而且還有有辦法保證右歪斜嗎?
3.給中序跟後序也為什麼可以是左歪斜呢
請問有例子可舉嗎?
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 60.251.200.33
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 2 之 3 篇):