assignments - WSUTC User Pages

advertisement
Assignment 1: due 1/13/16
Geometric sum
Prove by induction on integers that
n 1
x
1
k
x 

x -1
k 0
n
Assignment 2: due 1/20/16
Prove by induction on integers that recurrence
T(2k) = 2 if k=1
T(2k) = 2T(2k-1) + 2k if k>1
has solution T(2k) = k2k
Base case k=1 true by definition.
Show that also true for k=2.
Assignment 3: due 1/22/16
1) Ex 3.1-1 text p52
if f(n) and g(n) are asymptotically non-negative,
show that max(f(n),g(n))=Q(f(n)+g(n))
hints: how are f(n) and g(n) related to max(f(n),g(n))?
how is max(f(n),g(n)) related to f(n)+g(n)?
2) Use Stirling’s approximation (Eq(3.18) text p57) to give an
informal proof that lg(n!)=Q(nlgn). Show all steps.
Cpt S 350 Spring 2016
[All problems are from Cormen et al, 3rd Edition]
Homework Assignment 4: due 1/25/16
1. Use Stirling’ approximation, Eq(3.18) p 57,
to show that n! = o(nn) and n! = w(2n)
hint: use limits as n goes to infinity
2. prob 3-2 p 61
justify your answers to a through f
Example: A=nk, B=cn, k>0, c>1, is A = O(B), o(B), W(B),
w(B), Q(B), or none of these and why?
CptS 350 Spring 2016
[All problems are from Cormen et al, 3nd Edition]
Homework Assignment 5: due 2/5/16
1.ex A.1-3 p 1149 hint: use derviatives
2.ex A.1-6 p 1149 hint: let gk(n)=O(fk(n)) and use definition of Big O
CptS 350 Spring 2016
[All problems are from Cormen et al, 3nd Edition]
Homework Assignment 6: due 2/8/16
1.ex A.2-1 p 1156 (hint: use integration)
n
2.Find upper and lower bounds on
r
k
using bound each term

k 1
Assignment 7: due 2/10/16
Prove by substitution that T(n)=2T(n/2)+Q(n) has
T(n)=W(nlgn) as an asymptotic solution.
Prove by substitution that T(n)=8T(n/2)+Q(n2)
has T(n) = W(n3) as an asymptotic solution.
Prove by substitution that T(n) = 3T(n/4)+Q(n2)
has T(n) = O(n2) as an asymptotic solution.
Show constraints on c and n.
CptS 350 Spring 2016
[All problems are from Cormen et al, 3rd Edition]
Homework Assignment 8: due 2/12/16
ex 4.4-7 on page 93 (tree analysis and substitution)
Remember! Tight bound means Q
CptS 350 Spring 2016
[All problems are from Cormen et al, 3rd Edition]
Homework Assignment 9: due 2/24/16
1. Show by substitution that
T(n)=T(floor(n/3))+T(ceiling(2n/3)) + Q(n) has asymptotic
solution T(n)=W(nlgn)
2. problem 4-3f on page 108 by tree analysis and substitution
method for tight bounds.
CptS 350 Spring 2016
[All problems are from Cormen et al, 3rd Edition]
Homework Assignment 10: due 2/26/16
Show by substitution that T(n)=T(n-2)+ Q(n2) has asymptotic
solution T(n)=W(n3)
Cpt S 350 Spring 2016
[All problems are from Cormen et al, 3rd Edition]
Homework Assignment 11: due 3/4/16
Problems 4-1a, c and e on page 107 by master method
CptS 350 Spring 2016
Homework Assignment 12: due 3/11/16
Use T(n) = 0min
(T(q) + T(n-q-1)) + Q(n)
q  n 1
to show by substitution that Quicksort has a
best case runtime of T(n)=W(nlgn)
Hint: lg(n-1)=lg(n(1-1/n))=lgn+lg(1-1/n)
CptS 350 Spring 2016
All problems are from Cormen et al, 3rd Edition
Homework Assignment 13: due 3/24/16
1. Ex 7.2-2 p 178 explain output of partition, write a recurrence
for runtime of quicksort, solve the recurrence by tree analysis
2. Ex 7.2-5 p 178
3. Ex 7.4-1 p 184
4. Prove by substitution that T(n)=T(9n/10)+T(n/10)+Q(n) has
asymptotic solution T(n)=Q(nlgn)
Download