Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 1

1.

Use the informal definitons of O, Ꝋ and Ω to determine whether the following assertons
are true or false.
a. n(n+1)/2 ∈ O(n3) b. n(n+1)/2 ∈ O(n2) c. n(n+1)/2 ∈ Ꝋ (n3) d. n(n+1)/2 ∈ Ω (n)

2. List the following functons according to their order of growth from the lowest to the highest:
(n−2)! , 5lg(n+100)10 , 22n , 0.001n4+3n3+1 , ln2 n , 3 √n , 3n.

3. An image processing applicaton begins with two n×n matrices A and B. The first phase of
preprocessing the inputs takes O(n 2) steps for each of A and B. The second step involves a
convoluton of A and B to yield a new matrix C in tme O(n 3). This is followed by an edge
detecton phase that takes tmes O(n 2) for matrix C. What is the most accurate and concise
descripton of the complexity of the overall algorithm?

a. O(n2) b. O(n3) c. O(n2+n3) d. O(n5)

4. How many tmes is the comparison i >= n performed in the following program?

int i = 200, n = 80;


main(){
while (i >= n){
i = i-2;
n = n+1;
}
}

b. 40 b. 41 c. 42 d. 43

You might also like