考試

107清大資工計科[參考解答]

1. (12%)

(a) How many integer solutions of x+y+z15 satisfy x0,y3,z5?
(b) In how many ways can we select three distinct integers from 1 to 29 such that their sum is a multiple of 3?

參考解答:
(a) (4+717)=(107)=120
(b) 84 + 900+ 120 + 120 = 1224


2. (8%) A tree T has 2n vertices of degree 1, 3n vertices of degree 2, and n vertices of degree 3.

(a) Determine the value of n.
(b) What is the minimum number of edges that can be added to T so that the resultant graph will have an Euler circuit?

參考解答:(a) n = 2 (b) 3


3. (10%) Given a kZ+, the number of derangements dk is defined as the number of arrangements of 1,2,,k where none of the numbers 1,2,,k are in their natural position. Take k=4 as an example, 4,3,2,1 is considered as one of the dearrangements. We define d0=1 for convenience.

For all nZ+, use combinatorial arguments to prove the following equation n!=(n0)d0+(n1)d1++(nn)dn=k=0n(nk)dk.
Remarks: No marks will be given if your proof is not a combinatorial one.

參考解答:
考慮n個數作排序,共n!種可能,可分成以下幾種情形:
假設有n個數在自然位置上,則剩餘0個人不在自然位置上,方法數為(n0)d0
假設有n-1個數在自然位置上,則剩餘1個人不在自然位置上,方法數為(n1)d1
假設有n-2個數在自然位置上,則剩餘2個人不在自然位置上,方法數為(n2)d2

假設有0個數在自然位置上,則剩餘n個人不在自然位置上,方法數為(nn)dn
所以n個數作排序之方法數為
n!=(n0)d0+(n1)d1+(n2)d2++(nn)dn=k=0n(nk)dk


4. (10%) On the set Z, define relation R by aRb if ab is a nonnegative even integer.

(a) Prove or disprove that R is a partial order on Z.
(b) Prove or disprove that R is a total order on Z.
Remark: No marks will be given if you do not show your work.

參考解答:
(a)
aZ, 因為aa=0為非負偶數,所以aRa, 因此a具reflexive.
a,bZ, 假設aRb 且 bRa,ab0 且 ba0a=b, 所以R具antisymmetric.
a,b,cZ, 假設aRb 且 bRc, 則存在k1,k2為非負整數使得ab=2k1 且 bc=2k20ac=(ab)+(bc)=2k1+2k2=2(k1+k2)0aRc, 所以R具transitive.
因此R為partial order on Z.
(b) 取a=1,b=2Z, 因為(a,b)R 且 (b,a)R, 所以R不為total order on Z.


5. (6%) Please answer whether each of the following statements is correct.

(a) logn is in O(n0.1).
(b) n!+nn is in Θ(nn).
(c) 2n+nn is in Θ(2n).
(d) n! is in Ω(2n).
(e) 2n is in O(n100).
(f) nlogn is in Ω(n2).

參考解答:(a) T (b) T (c) F (d) T (e) F (f) F


6. (6%)

(a) Please draw the graph with the following sequential representation.

mt01

(b) Please draw the graph with the following representation of adjacency multilists.

mt02

參考解答:
(a)

mt03

(b)

mt04

7. (18%)

(a) Please draw the min heap (shown as follows) following a delete min.

mt05

(b) Please draw the min-max heap (shown as follows) following a delete min.

mt06

(c) Please draw the deap (shown as follows) following a delete min.

mt07

(d) Please draw the min leftist tree (shown as follows) following a delete min.

mt08

(e) Please draw the 2-3-4 tree (shown as follows) following the deletion of 15.

mt09

(f) Please draw the red-black representation of 2-3-4 tree shown in (e).

參考解答:
(a)

mt10

(b)

mt11

(c)

mt12

(d)

mt13

(e)

mt14

(f)

mt15

8. (30%) For an input connected undirected graph G,

  • the HP problem asks if G contains a Hamiltonian path; and
  • the HC problem asks if G contains a Hamiltonian circuit.

(a) Describe a polynomial-time reduction from HP to HC, and explain why such a reduction works.
(b) Describe a polynomial-time reduction from HC to HP, and explain why such a reduction works.
Remark: No marks may be given if the reduction does not work, or the explanation is incomplete.

參考解答:


試題(pdf):連結

有任何問題,或想要完整解釋的,歡迎在下方留言唷!

4 留言

  1. Jackson

    您好,想問畫圖7(d) node 10 左子應該是 15 不是 5 吧?
    還有 7(f) 不是指畫原圖的意思嗎? 謝謝

  2. Mason

    不好意思 想請問一下 第6題的 (b) 小題,N2 跟 N5 好像不會Linked 到,所以1 與 3、0 與 2的點應該不會相連 !? 不知道是不是我會錯意了,感謝指教~~

回覆留言對象 取消回覆