

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Class: Discrete Structures; Subject: Computer Science; University: University of Illinois - Urbana-Champaign; Term: Spring 2007;
Typology: Assignments
1 / 2
This page cannot be seen from the preview
Don't miss anything!


a) Show that if f ( x ) is O ( x log
2
( x )) , then f ( x ) is O ( x
2
b) Show that for all real numbers a and b with a > 1 and b > 1, if f ( x ) is O (log
b
x ) , then f ( x ) is
O (log
a
x ) .
c) (bonus) Show that if , where a
0
, a
1
,L a
n
are real numbers
and a
n
, then f ( x ) =Θ( x
n
Consider the following functions:
n
2
log
2
(log
2
n )
n
3
n
2
n log
2
n
4
n!
| sin( n
n
n
3
n
100
k k = 1
n
n
2
n
a) Find a good big- O estimation of each of the above functions. A formal proof is not needed, but
you must explain your reasoning.
b) Sort them in decreasing order of growth rate.
Consider the following algorithm:
a) Give a good time complexity bound (a tight big- O estimate) of this algorithm.
b) What is the time complexity bound if we change j :=
j
to
j := j− 1 ? Is it the same bound as the
one in a)?
c) What is the time complexity bound if we change j := n
2
to j := n
4
? Is it the same bound as the
one in a)?
Let’s derive a formula for k
2
k = 1
n
in this problem. Parts a) through c) illustrate the technique we’ll
use, but on an easier problem: k
k = 1
n
a) Find a formula for ( k
2
−( k − 1 )
2
k= 1
n
( Hint: expand the summation without computing
k
2
−( k − 1 )
2
explicitly. Most of the terms in the expansion will cancel out each other ).
b) Find a formula for ( 2 k − 1 )
k= 1
n
by summing both sides of the identity k
2
−( k − 1 )
2
= 2 k − 1.
c) Using the result of b), find a formula for k
k = 1
n
d) Find an identity for k
3
−( k − 1 )
3
e) Summing both sides of the identity found in d), find a formula for the right side.
f) Using the result of c) and e), find a formula for k
2
k = 1
n
algorithm mystery (positive integer m ; positive integer n )
j := n
2
while (
j > 1 )
i := 1
while ( i < m )
i := 3 i
end while
j :=
j
end while
end algorithm mystery