• 沒有找到結果。

程式設計

N/A
N/A
Protected

Academic year: 2021

Share "程式設計"

Copied!
2
0
0

加載中.... (立即查看全文)

全文

(1)

1

-國立台中師範學院九十四學年度研究所碩士班考試

程式設計 科試題

一、Given the following diagraph:

1. Show the Adjacency matrix of this digraph(10%) 2. Show the orders using BFS traversal from node B(10%) 3. Show the orders using DFS traversal from node B(10%)

二、選擇題:

1. For an already sorted array of sizen, which of the following algorithm is asymptotically the slowest?(5%)

n Insertion Sort o Merge Sort p Quick Sort q Counting Sort

2. To find both the maximum and minimum of n numbers, how many comparisons are necessary in the worst case? (5%)

n 3 n

/2

o

3n/2

p 3n/2-2 q

3n/2

−2

3. Which of the following functions has the fastest rate of growth? (5%) n (log n )! o logn ) 2 ( p logn 4 q 3 n

4. Which of the following sorts are in-place and stable? (5%) n INSERTION SORT o QUICK SORT p HEAP SORT q COUNTING SORT 數教所、測統所 用 G A H I B C D E F

(2)

2

-5. What value is returned by the following code when

n

=

10

?(5%) MYSTERY

( )

n

1.

r

0

2. for

i

1

to

n

3. do for

j

1

to

i

4. do

r

= r

+

1

5. return

r

n 110 o 109 p 55 q 54 三、 使用任何程式語言寫出計算二元樹的高度。(25%)

四、 Given the Fibonacci numbers as 1, 1, 2, 3, 5, 8, 13, 21, 34, …, where the next Fibonacci number will be the sum of its previous two Fibonacci numbers

a. Write a recursive program to generate the N’th Fibonacci number.(5%) b. Write a non-recursive program using the loop-structure to generate the N’th

Fibonacci number.(5%)

五、 Please draw out the AVL trees after inserting 4 and then 3 separately in the following AVL tree. (10%)

參考文獻

相關文件

• Metropolis sampling can efficiently generate a set of samples from any non negative function f set of samples from any non-negative function f requiring only the ability to

– The The readLine readLine method is the same method used to read method is the same method used to read  from the keyboard, but in this case it would read from a 

• Appearance: vectorized mathematical code appears more like the mathematical expressions found in textbooks, making the code easier to understand.. • Less error prone: without

Thoughts: The discovery of this epitaph can be used by the author to write a reference to the testimony of the book Tuyuan Cefu, to fill the lack of descriptions

Clinical Supervision Practices and Satisfaction Within the Public Vocational Rehabilitation Program. Effectiveness of a Training Program to Enhance Clinical Supervision

In section29-8,we saw that if we put a closed conducting loop in a B and then send current through the loop, forces due to the magnetic field create a torque to turn the loopÆ

This kind of algorithm has also been a powerful tool for solving many other optimization problems, including symmetric cone complementarity problems [15, 16, 20–22], symmetric

„ A socket is a file descriptor that lets an application read/write data from/to the network. „ Once configured the