CPSC 311-501 and CPSC 311-502: Analysis of Algorithms
Homework Assignment #6
Spring 2003


General Guidelines for Homework


Assigned Problems

Due: Tuesday March 18, 2003 at the beginning of class

  1. Exercise 22.2-3 in the text (p. 539). (5 points)

  2. Exercise 22.2-6 in the text (p. 539). (10 points)

  3. Exercise 22.4-1 in the text (p. 551). (10 points)

  4. Consider the following sequence of makeset, union, and find operations (20 points):
    for i := 1 to n
      makeset(i)
    for i := 1 to n-1
      union( find(i), find(i+1) )
    for i := 1 to n
      find(i)
    


    (a) Analyze the time complexity of the above sequence of operations assuming no heuristics are applied (i.e., no weighted union, and no path compression). Assume union(x,y) always makes x a child of y.


    (b) Analyze the time complexity of the above sequence of operations assuming the weighted union heuristic (but not path compression) is applied.


    (c) Analyze the time complexity of the above sequence of operations assuming the path compression heuristic (but not weighted union) is applied. Assume union(x,y) always makes x a child of y.


    (d) Analyze the time complexity of the above sequence of operations assuming both weighted union heuristic and path compression are applied.


Bonus Problems

Due by Tuesday April 1, 2003

These problems can be done for extra credit. Points for bonus problems will be tabulated separately, and will be considered separately at the end of the semester.

They should be turned in separately from your regular assignment. They will be accepted upto two weeks past the due date of the assignment.