計算機概要,二元樹前中後序走訪問題 - 考試
By Zanna
at 2015-06-28T21:53
at 2015-06-28T21:53
Table of Contents
各位大大好,題目如下
有一棵二元樹(binary tree)的後序走訪(postorder traversal)結果為DEBFGCA,中
序走訪(inorder traversal)為DBEAFCG,請問此樹的前序走訪(preorder traversal)
結果為何?
(A)ABDECFG (B)ABCDFEG (C)ADBECFG (D)ABDCEGF
個人分析後,覺得後序、中序的二元樹長成下面這樣
A
/ \
B C
/ \ / \
D E F G
然後前序的走法應該是,根左右
所以感覺答案應該是ABDECFG,但是答案卻是B......0.0
我所知的中序的走法應該是左根右,後序的走法應該是左右根
是哪裡出的問題嗎@@?
--
有一棵二元樹(binary tree)的後序走訪(postorder traversal)結果為DEBFGCA,中
序走訪(inorder traversal)為DBEAFCG,請問此樹的前序走訪(preorder traversal)
結果為何?
(A)ABDECFG (B)ABCDFEG (C)ADBECFG (D)ABDCEGF
個人分析後,覺得後序、中序的二元樹長成下面這樣
A
/ \
B C
/ \ / \
D E F G
然後前序的走法應該是,根左右
所以感覺答案應該是ABDECFG,但是答案卻是B......0.0
我所知的中序的走法應該是左根右,後序的走法應該是左右根
是哪裡出的問題嗎@@?
--
Tags:
考試
All Comments
By Delia
at 2015-07-02T21:40
at 2015-07-02T21:40
By Caitlin
at 2015-07-03T07:07
at 2015-07-03T07:07
By Zenobia
at 2015-07-04T01:38
at 2015-07-04T01:38
By Yuri
at 2015-07-07T16:12
at 2015-07-07T16:12
By Damian
at 2015-07-08T16:10
at 2015-07-08T16:10
By Bethany
at 2015-07-12T02:49
at 2015-07-12T02:49
Related Posts
後中三元書籍
By Frederic
at 2015-06-28T21:16
at 2015-06-28T21:16
民事訴訟 支付命令修法
By Caroline
at 2015-06-28T18:29
at 2015-06-28T18:29
信託考過啦啦
By Franklin
at 2015-06-28T17:52
at 2015-06-28T17:52
兼職考生選擇休閒時間的限制
By Eden
at 2015-06-28T17:25
at 2015-06-28T17:25
民法選擇疑問
By Enid
at 2015-06-28T17:24
at 2015-06-28T17:24