CS 205 Quiz #6B – Nov 8, 2012
NAME:
RUID:
Electronic Devices are not permitted during the quiz. These include but are not restricted to calculators, computers and cell phones.
No communication between students or anyone outside of class is permitted during the quiz.
Textbooks, notes and any other written materials are not permitted during the quiz.
DO NOT OPEN UNTIL INSTRUCTED TO DO SO
1.
In each blank, write the letter of the formula that most closely provides the number of iterations performed by the corresponding loop. Ignore any requirement to use a ceiling or floor function. Note that an option may be used zero or more times (i.e. once, more than once, not at all).
A) 
lg(x _{0} – a) 
B) lg(a  x _{0} ) 
C) lg(a) 
D) lg(x _{0} ) 

E) 
lg(x _{0} / a) 
F) lg(a / x _{0} ) 
G) log _{x}_{0} (a) 
H) log _{a} (x _{0} ) 

I) 
lg(log _{x}_{0} (a)) 
J) lg(log _{a} (x _{0} )) 
K) log _{a} (x _{0} )/lg(a) 
L) 
a  x _{0} 

M) 
log _{x}_{0} (a)/lg(a) 
N) log _{x}_{0} (a)/lg(x _{0} ) 
O) x _{0} + a 
P) x _{0} 
– a 

Q) 
lg(log _{x}_{0} (a)) 
R) lg(log _{a} (x _{0} )) 
S) x _{0} 
^ a 
T) 
a 
^ x _{0} 
U) 
log _{x}_{0} (a)/lg(a) 
V) log _{x}_{0} (a)/lg(a) 
W) x _{0} 
_{X}_{)} _{∞} 
a)
b)
c)
d)
e)
x
x _{0} while x > a
end
x
x 
1
x
x _{0} while x < a
end
x
2x
x
x _{0} while x < a
end
x
x /
2
x
x _{0} while x < a
end
x x ^{2}
x
x _{0} while x > a
end
x
√
where:
and
x _{0} a < x _{0}
a
are integers
where:
x _{0}
0 < x _{0}
and
a
are real numbers
< a
where:
x _{0}
0
where:
x _{0}
1
and 
a 
are real numbers 
< a 
< 
x _{0} < 1 
and 
a 
are real numbers 
< a 
< x _{0} 
where:
x _{0}
1 <
and
a a < x _{0}
are real numbers
2. Find the least integer n such that f(x) possible, write “Impossible”.
is
O(x ^{n} )
a) f(x) = 2x ^{2} + x ^{3} log x
b) f(x) = 3x ^{5} + (log x) ^{4}
for each of these functions. If no such
n
is
c) f(x) = (x ^{4} + x ^{2} + 1)/(x ^{4} + 1)
d) f(x) = (x ^{3} + 5log x)/(x ^{4} + 1)
e) f(x) = x / log x
f) f(x) = x ^{2} (log x) ^{8} + x ^{2}
g) f(x) = x ^{2} (8x ^{2} + 3x + 5log x)
h) f(x) = _{√} 
+ _{√} 
i) f(x) = _{√} 
/ _{√} 
j) f(x) = x ^{5} (√
+ 1/x)
3.
Recall that to establish a bigΩ relationship, we find C and k such that f(x) ≥ C • g( )
for
the given C and k establish a bigΩ relationship. Otherwise, write “False”.
x > k. Assume C, k and x are real numbers. For each of the following blanks, write “True” if
a) f(x) = x + 0.5,
f(x) = Ω(x)
C = 1,
k
= 1
C = 1.5, k = 3
C = 0.5, k = 1
C = 0.1, k = 0
b) f(x) = x ^{2} + x,
c) f(x) = 2 ^{x} + 2x,
f(x) = Ω(x ^{2} )
C = 2, 
k 
= 0 
C 
= 2, 
k = 
1 

C = 2, 
k 
= 2 
C = 0.5, k = 2 

f(x) = Ω(2 ^{x} ) 

C = 
1, 
k 
= 1 
C 
= 2, 
k = 
1 
C = 2, 
k 
= 2 
C = 0.5, k = 2 
d) f(x) = lg(x) + 4,
e) f(x) = x! + 2 ^{x} ,
f(x) = Ω(lg(x))
C =
1,
k
= 1
C = 2, k = 16
f(x) = Ω(x!)
Assume
x ∈ N
C =
1, k = 16
C = 1, k = 256
for this problem only
C = 1, 
k 
= 1 
C = 1/4, k = 2 

C = 0.5, k = 4 
C = 
2, k = 
0 

f) f(x) = 7 + 1/x, 
f(x) = Ω(1) 

C = 
7, 
k = 0 
C = 
7, 
k = 1 

C = 
8, 
k 
= 0 
C = 
8, k = 
1 
4.
What is the effect in the time required to solve a problem when you increase the size of the input
from
with input size
size 2n and let W _{0} denote the runtime with input size n. In each blank, write the corresponding letter from the table below. Note that an option may be used zero or more times (i.e. once, more than once, not at all).
n
to
2n, assuming that the number of milliseconds the algorithm uses to solve the problem
n
is each of the quantities expressed below? Let W _{1} denote the runtime with input
A)
D)
G)
J) W _{1}  W _{0} = lg(n+1) – lg(n)
W
W
_{1}
_{1}
 W _{0}  W _{0}
= 0
= n
W _{1}  W _{0} = lg((1+lg(n))/lg(n)
M) W _{1} / W _{0} = 2n
P) W _{1}
/ W _{0}
= 2 ^{n}
S)
W _{1} / W _{0} = 2 + 2/lg(n)
B) W _{1}  W _{0}
E) W _{1}  W _{0} = 2n+1
H) W _{1}  W _{0} = lg(1+lg(n))
K) W _{1} / W _{0}
= 1
= 2
N) W _{1} / W _{0} = 2n+1
Q) W _{1} / W _{0}
= n ^{2}
T) W _{1} / W _{0} = 2 + lg(n)
C) W _{1}
F) W _{1}  W _{0} = n ^{2}
I) W _{1}  W _{0} = lg(n)
L) W _{1}
 W _{0}
= 2
/ W _{0}
= 4
O) W _{1} / W _{0} = lg(n)
R) W _{1} / W _{0} = lg(n ^{2} )
U) W _{1} / W _{0} = 2 lg(n)
a) 2
b) lg n
c) n
d) 2n
e) n lg n
f) n ^{2}
g) 2 ^{n}
Scratch Paper
Much more than documents.
Discover everything Scribd has to offer, including books and audiobooks from major publishers.
Cancel anytime.