Professional Documents
Culture Documents
Homework #1!
!
!
The following questions pertain to understanding Algorithm Analysis. Answer in a text file or pdf
and submit to t-square by midnite Friday 23 May.!
1.
!
2.
!
Experiments show algorithm A has a T(n) = 40n2. Algorithm B has a T(n) = 2n3. Determine
the n0 such that for which Algorithm A is better than B for all n >= n0.!
Show that if d(n) is O(f(n)) and f(n) is O(g(n)) then d(n) is O(g(n)).!
3. Al and Bob are always arguing over their algorithms. Al claims his O(n log n) algorithm is
always faster than Bobs O(n2). They finally decide to do some experiments and to Als surprise,
his algorithm is slower for n < 100 and it is only faster for n >=100. Explain how this could
happen.!
4.
!
!
!
!
!