97年高考資料結構題目!!(第二題) - 考試

By Barb Cronin
at 2013-09-24T22:12
at 2013-09-24T22:12
Table of Contents
二、有一個二元搜尋樹(Binary Search Tree) T如下:
11
╯ ╰
8 13
╯ ╰ ╯ ╰
3 10 12 15
╯
14
(一)若欲搜尋的鍵值(Key)平均分布在1到100之間,請算出該值於搜尋樹中平均要比較
幾次??
ans..
高X:2點多次
某補習班:3點多次
┌──────────────┐
│ key │比較次數│機率 │
└──────────────┘
│1-2(失敗)│ 3 │0.02
└──────────────┘
│3 │ 3 │0.01
└──────────────┘
│4-7(失敗)│ 3 │0.04
└──────────────┘
│8 │ 2 │0.01
└──────────────┘
│9 (失敗) │ 3 │0.01
└──────────────┘
│10 │ 3 │0.01
└──────────────┘
│11 │ 1 │0.01
└──────────────┘
│12 │ 3 │0.01
└──────────────┘
│13 │ 2 │0.01
└──────────────┘
│14 │ 4 │0.01
└──────────────┘
│15 │ 3 │0.01
└──────────────┘
│16-100(失敗) 3 │0.85
└──────────────┘
請問關於key值失敗的比較次數是3次(高X),或4次(某補習班),考試的答案兩種寫法都可
以嗎??
感謝解答!!
--
11
╯ ╰
8 13
╯ ╰ ╯ ╰
3 10 12 15
╯
14
(一)若欲搜尋的鍵值(Key)平均分布在1到100之間,請算出該值於搜尋樹中平均要比較
幾次??
ans..
高X:2點多次
某補習班:3點多次
┌──────────────┐
│ key │比較次數│機率 │
└──────────────┘
│1-2(失敗)│ 3 │0.02
└──────────────┘
│3 │ 3 │0.01
└──────────────┘
│4-7(失敗)│ 3 │0.04
└──────────────┘
│8 │ 2 │0.01
└──────────────┘
│9 (失敗) │ 3 │0.01
└──────────────┘
│10 │ 3 │0.01
└──────────────┘
│11 │ 1 │0.01
└──────────────┘
│12 │ 3 │0.01
└──────────────┘
│13 │ 2 │0.01
└──────────────┘
│14 │ 4 │0.01
└──────────────┘
│15 │ 3 │0.01
└──────────────┘
│16-100(失敗) 3 │0.85
└──────────────┘
請問關於key值失敗的比較次數是3次(高X),或4次(某補習班),考試的答案兩種寫法都可
以嗎??
感謝解答!!
--
All Comments

By Sandy
at 2013-09-28T02:32
at 2013-09-28T02:32

By Barb Cronin
at 2013-09-28T04:06
at 2013-09-28T04:06

By Daniel
at 2013-10-02T09:57
at 2013-10-02T09:57

By Lucy
at 2013-10-06T08:31
at 2013-10-06T08:31
Related Posts
國營100年新進職員試題(刑訴)

By Jacob
at 2013-09-24T21:21
at 2013-09-24T21:21
公股銀的人資工作是人事考進去的嗎

By Audriana
at 2013-09-24T21:19
at 2013-09-24T21:19
中油雇員報名問題

By Agatha
at 2013-09-24T21:03
at 2013-09-24T21:03
102高考公職社工師普考社會行政雙榜心得

By Harry
at 2013-09-24T20:35
at 2013-09-24T20:35
每年普考都有警察局的技術缺

By Jack
at 2013-09-24T19:41
at 2013-09-24T19:41