CS 215 - Fundamentals of Programming II
Spring 2008 - Homework 4
20 points


Out: February 13
Due: February 20


Answer the following exercises from the textbook and additional questions. When a question says “implement” just write the implementations on paper. You do not need to type the code into the computer (unless you want to, of course).


  1. (6 points) Exercise 9 on page 212.

  2. (2 points) Exercises 10-11 on page 212.

  3. (4 points) Exercises 14-16 on page 213.

  4. (4 points) Exercise 17 on page 213. Note: there is a typographical error in the strategy for (a). It should say "while i < j".

  5. (2 points) Assume a vector has values {19, 13, 7, 12, 16}. Show the order of elements in the vector after each pass of the insertion sort algorithm.

  6. (2 points) Assume a vector has values {19, 13, 7, 12, 16}. Show the order of elements in the vector after each pass of the exchange sort algorithm (from Project 3).


02/12/08 1 of 1