Lab 2 Fall 2009
This lab is to review Chapter 0 of the text book.
Please go to your lab, do the problems to get your full credit for the lab.
- Using L'Hospital's rule, prove that the function log(n) grows slower than n0.5
(in fact log(n) grows slower than even n x for 0 < x &le 1).
(optional:Use your proof to show log(log(n)) grows slower than (log(n))2).
- Arrange the following functions in increasing order of their growth rate.
(3/2) n;n; n!; 106 ; 7; 3 n; 3 sqrt(log(n)); n n; n log(n) ; n 3 n; n 4/3 ; 3 3 n ; n 5 ; log(log(n)); 0.5 n log(n+5);
- Write a funcion MERGE3 that takes three sorted lists and merges the, into one list. (Write a pseudo code, state the worst case running time).
- Write a new merge sort procedure that uses MERGE3 that takes 3 sorted
lists and merges them. ( Implement this algorithm and test it for Home Work 2 and not for this lab .)
- Show that 18n 3 logn + 100 n 2 +500 = O(n3log(n));
- Can big Oh in the above problem be replaced with theta?
- Optional: Show that log(n!) = theta(n log (n)). (Hint: we have shown in class
n! is O(n n ) - please reconstruct the argument. Show n! is greater than (n/2) n/2 - combining these two you will get the theta bound).