You are on page 1of 2

Data Structure Ch1~2 Class:__________ Name:__________ Student ID:__________

1. (a)What are the criteria of an algorithm?(10%)


(b)What are the five phase of a system life cycle?(10%)

2. There is a part of program. Please compute its time complexity θ(n) and prove it.(20%)
i=1;
sum=0;
while (i<=n)
{
sum = sum+i;
i=i×2;
}

0 3 0 0 0
0 0 0 0 3

3. G  0 0 2 0 0 , use a two-dimensional array to represent sparse(稀疏) matrix G & GT .(20%)
 
1 0 0 0 2
0 0 1 0 0
4. Use array to represent the following function?(Avoid wasting space as much as you can)(20%)
(a) f(x)=3x2+2x+4
(b)g(x)=x3+1
(c) f(x)+g(x)
(d)f(x)*g(x)

5. Show each state of the list (1, 6, 8, 13, 19, 22, 27) for (a) and (b) by using binary search:(20%)
(a) search 19
(b) search 7

You might also like