Introduction to Algorithms : Problem Set 1
Print this page
 
   
  1. Given an array of n integers, write an algorithm to find the smallest element. Find number of instruction executed by your algorithm. What are the time and space complexities?
  2.  Write a algorithm to find the median of n numbers. Find number of instruction executed by your algorithm. What are the time and space complexities?
  3. Write a C program for the problem 1.
  4. Write a C program for the problem 2.
  5. Solve the following recurrence relations. Assume T(1) = O(1)
 
  1. T(n)  = T(n-2) + cn
  2. T(n ) = 2T(n/2) + c n^2
  3.  T(n)  = 2T(n/2) + c n^3
  4.  T(n)  = 4 T(n/4) + O(n)
  5. T(n)  = 4 T(n/2) + c n
  6. T(n)  = T(n/2) + O(1)
  7. T(n)  = 2T(n/2) + n log n
  8. T(n)  = T(n-1) + 1/n
  9. T(n)  = T(n/2) + log n
  10. T(n)  = T( ) + 1
 
   
Prev
First | End