COS 226 Homework #1
Due: Friday, February 11, 2005

Written Exercises

Follow the instructions on the assignments page on how and when to turn these in.  Each of these problems is worth 5 points.  Be sure to also complete the programming part of this assignment, including the written program report.

  1. [Exercise 1.5, revised] Draw the resulting tree after running the quick-union algorithm (Program 1.2) on the sequence:
    0-2, 1-4, 2-5, 3-6, 0-4, 6-0, 1-3

    Caveat: your tree should be produced exactly as in Program 1.2, so don't interchange the roles of i and j.
     
  2. Which, if any, of the following programs from the textbook are stable: selection (Program 6.12), insertion (Program 6.13), or bubblesort (Program 6.14)?  Briefly justify your answer.