1
國立台中教育大學九十五學年度研究所碩士班招生考試
程式設計 科試題
一、選擇題(共 10 題,每題 5 分)Please answer question 1-5 based on the following situations (1) A hash table of size m is used to store n items, with
2
m
n≤ , and the load factor n
m
α = .
(2) Open addressing is used for collision resolution.
(3)Xi denotes the number of probes required by the i-th insertion, where i=1, 2,L ,n
(4) 1 max i i n X X ≤ ≤
= denotes the maximum number of probes required by any of the n insertions. 1. What is the expected number of probes in a successful search at most?
c 1ln 1 1 α −α d 1 ln α e 1 ln (1 ) α −α f 1 1 ln 1−α α 2. What is the expected number of probes in an unsuccessful search at most?
c 1 α d 1 1−α e 1 (1 ) α −α f1 α α −
3. Let p is the probability of i Xi >2 log2n. Which of the following statements is correct? cpi ≤ α d pi > α e pi 12
n
> fpi 12
n
≤
4. Let p is the probability of X >2 log2n. Which of the following statements is correct? cp 1 α ≤ d p 1 α > e p 1 n > fp 1 n ≤
5. Assuming uniform hashing, what is the probability that the i-th insertion requires strictly more than k probes at most?
c 1 2k d 1 k α− e 1 k f 1 ln k
6. If a n-element heap with height h, how many nodes will be at most? c +1 2h n d +1 2h n e −1 2h n f −1 2 log hn
7. Which of the following arrays are NOT binary heaps?
c 1,1,1,1,1 d 6,5,4,3,2,1 e 6,4,2,3,1,2 f 6,4,3,1,3,4 8. What is the rank by order of growth for the following:
2 n ,n!, 2n 2 ,log2n, 2n 2 ,n log n ,
n2
n,n
3? c nlog n ,log2 n,n2,n
3,n2
n ,n!,22n,22n d log2 n,nlog n ,n2,n
3,n2
n ,n!,22n,22n e log2 n,nlog n ,n2,n
3,n2
n ,22n,n!,22n f 2 n log ,nlog n ,n2,n
3,n2
n ,22n,22n,n! 測統資訊組、數教資訊組 用 背面尚有試題2 9. Suppose the following letters have the indicated frequency in a message. What is the
average Huffman code length?
Key Frequency A B C D 7 3 4 1 Total 15 c 5 9 d 15 28 e 15 29 f 2
10. Use the double-ended queue (dequeue) to input: 1, 2, 3, 4, 5, 6, and 7 sequentially. In the following, what are the impossible outputs?
c 5174236 d 1234567 e 2143756 f 7615243 g4213765 二、問答題(共 5 題,每題 10 分) 1. 請以 binary search 設計一段演算法,搜尋下列資料中的數字 50 資料列: 37, 57, 23, 15, 50, 32, 80, 12, 19, 21 2. 請寫ㄧ程式使用 Bubble Sort 將陣列 X[n]內所有元素,由小到大重新排列,並將 結果印出。 3. 試述關聯式資料庫(Relational Database)的正規化(Normalization)中,第一正規化 (First Normal Form)、第二正規化(Second Normal Form)、第三正規化(Third Normal Form)及 Boyce-Codd 正規化。
4. Please write out a recursive program to calculate the Great Common Divisor. (10%) 5. Assume that there is an integer number series: 2, 8, 10, 13, 14, 15, 21, 26, 33, 34, 38,
50. Please search 10 and 36 in this number series by Interpolation Search algorithm, and describe the searching procedure step by step. (10%)