COP 4530 Fall 2004: Assignment 1

Assignments should be submitted as described in HWinstructions.html (for written assignments). Due: 20 Sep 2004, by 5 pm.

You must justify all your answers.

  1. Chapter 2, exercises 2c.
  2. Chapter 2, exercise 3e.
  3. Chapter 2, exercise 4b.
  4. Prove that n2 + n + 1 is O(n2), using definition 1 directly. Give constants c and N that satisfy the definition.
  5. Prove that n2 - n - 1 is Theta(n2), using definition 3 directly. Give constants c1, c2, and N that satisfy the definition.
  6. Assume that the running time of an algorithm is log2 n, for an input of size n. If the the time taken on input of size m is s seconds, then what is the running time on an input of size 4m? (Your answer will be some function of s.)
  7. Chapter 2, exercise 9, the third set of loops.
  8. Chapter 2, exercise 10d.
  9. Chapter 2, exercise 11. Give the constant that goes with the highest order term too.
  10. Derive the amortized cost of n insertions into a vector, if the capacity of the vector were made three time the current capacity, whenever an insertion would cause the current capacity to be exceeded. Assume that the initial capacity is 1.

Last modified: 14 Sep 2004