Homework #9 Due: 12/3/04 (F)

1) Suppose that you have an algorithm that required 10 seconds to run on a problem size of 1000. How long would you expect the algorithm to run on a problem size of 10,000?

2) Determine the (a) obvious big-oh notation, (b) trace the algorithm, and then (c) determine the theta notation for the following algorithm:

i := n

while (i >= 1) do

for j := 1 to i do

some code that takes time

end for j

i := i / 2

end while

3) Determine the (a) obvious big-oh notation, (b) trace the algorithm, and then (c) determine the theta notation for the following algorithm:

for i := 1 to n do

for j := 1 to i do

k = 1

while (k < n) do

some code that takes time

k = k * 2

end while

end for j

end for i

4) Determine the (a) obvious big-oh notation, (b) trace the algorithm, and then (c) determine the theta notation for the following algorithm:

i := n

while i > 0 do

j = n

while j > i do

for k = 1 to n do

some code that takes time

end for

j = j / 2

end while

i := i / 2

end while