Weitere ähnliche Inhalte
Ähnlich wie 資料結構平常測驗 (20)
資料結構平常測驗
- 1. 資料結構平常測驗一 A[0]
row column value
0 1 3
( 20111006 第六節)
A[1] 0 3 9
A[2] 1 0 -5
1) 是非題 (20 分)。 ⃝ 代表正確、 × 代替錯誤,
A[3] 2 1 15
△ 代表不確定,每題答對得 2 分、答錯倒扣 2 A[4] 2 4 1
分、填 △ 可得 0.5 分。 A[5] 3 2 10
a) 一個演算法一定要在有限步驟執行完成。 A[6] 4 0 8
b) 3n = O(2n )。 A[7] 4 5 -3
c) 若 f (n) = O(g(n)) 則 f (n) = Ω(g(n))。 A[8] 5 1 21
d) C++ 中一個 class 只能有一個 desctruc-
tor。 7) (10 分) 請寫下一個函數,傳入三個正的參數
e) 邏輯上,陣列的元素一定都儲存在連續 m, n 與 k,判斷是否存在一個三角型的三邊長
的記憶體位置上。 與此三個數字相同,並傳回執行結果。
f) n1.999 + n2 / log n = O(n2 / log n)。
8) (10 分) 請簡單解釋下列名詞的意思
g) The best case of binary search for n ele-
ments is Θ(logn). a) dynamic memory allocation
∑n 2 b) function overloading
h) i=1 i = Θ(n )。
i) 稀疏矩陣 (sparse matrix) 與稀疏多項式 c) data encapsulation
(sparse polynomial) 的儲存方式都是只存 d) implementation
非零的項目。 e) specification
j) selection sort 做 n 筆資料的排序的時間
複雜度為 Θ(n2 )。 9) (5 分) 請問下列英文的中文大意。
Determining the exact step count of a program
can prove to be an exceedingly difficult task.
2) (10 分) 請問下列 C 語言的函式,用 f (6) 呼 Expending immense effort to determine the
叫,傳回的值是多少? step count exactly is not a very worthwhile
long f(int n) { endeavor, since the notion of a step is itself
if (n <= 1) return 1; inexact. Because of the inexactness of what a
return n + 2*f(n-2); step stands for, the exact step count is not very
} useful for comparative purposes.
10) 這學期資料結構的課程中
3) (10 分) 請證明下列式子是正確的。 a) 請問您在 iCourse 的使用上有什麼問題或
a) 3n2 + 30n = Ω(n2 ) 改進的建議。(3 分)
b) 3n − 10n2 = Θ(3n ) b) 請問您在寫程式時是否遇到什麼困難與
問題。(3 分)
c) 請問網路帶給您最大的幫助與最大的阻
4) (10 分) 請證明下列式子是錯誤的。
礙是什麼?(2 分)
a) 2n2 + 10n = Θ(n)
b) 4n2 + n log n = Ω(n3 )
5) (10 分) 將下列數學函數排成 g1 , g2 , · · · , g10 ,
滿足 g1 = O(g2 ), g2 =√ 3 ), · · · , g9 = O(g10 ):
O(g
n
1.001n , n100 , n3 , log n , n, log2 n, log2 log2 n,
2
2 n
2n , 22 , n.
6) (20 分) 請寫下下列 6 的 sparse matrix 的轉
置矩陣 (transpose),照 FastTranspose 的演算
法,請計算 RowSize 與 RowStart 的值,並寫
下最後轉置矩陣的結果。