[理工][資結] 有關二元樹的問題

看板Grad-ProbAsk作者 (SG )時間15年前 (2011/01/11 11:53), 編輯推噓1(102)
留言3則, 2人參與, 最新討論串1/2 (看更多)
If the preorder or a binary tree is ABCDEFGHI , and the inorder representation is BDCAFHGEI, What is the original binary tree? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 115.43.41.89

01/11 12:20, , 1F
請排版高手來畫圖解釋這題~
01/11 12:20, 1F

01/11 16:11, , 2F
可以由preorder知道哪個點是root(DLR),找到root後,在根
01/11 16:11, 2F

01/11 16:12, , 3F
據inorder來分左右子樹,遞迴做下去就可以了
01/11 16:12, 3F
文章代碼(AID): #1DAzGh7N (Grad-ProbAsk)
文章代碼(AID): #1DAzGh7N (Grad-ProbAsk)