Fall 2002 CSCI 333 Homework 2

This homework is not graded. It is practice for the 25 September quiz.

Problem 1

Give the simplest big-Θ for the following functions:

  1. 15 n3 + 2 n2 + 2002
  2. 3n + n2002 + 2002
  3. 1030 n
  4. 15 n log n + 20 n
  5. 17 log n
  6. 17 log2 n
  7. 17 log2 (n5)

Problem 2

Give the simplest big-Θ in terms of n for the following nested loops:

  1. for (i=0; i<=n; ++i)
      for (j=0; j<10000; ++j)
        ++sum ;
  2. for (i=0; i<=n; ++i)
      for (j=0; j<n-10000; ++j)
        ++sum ;
  3. for (i=0; i<=n; i=i+3)
      ++sum ;
  4. for (i=0; i<=n; i=i+(n/10000)+1)
      ++sum ;
  5. for (i=0; i<=n; i=3*i+1)
      ++sum ;
  6. for (i=0; i<=n; i=10*i)
      ++sum ;
  7. for (i=0; i*i<=n; ++i)
      ++sum ;