Homework 1

CS 23

30 pts., due Feb. 14

Write C++ functions to solve each of the following problems. Use pre- and post-conditions for documentation. Construct a loop invariant for each loop.

  1. Factorial of n.

  2. Determining the smallest value among n integers.

  3. Bubble sort of n integers.

  4. Determining the second smallest value among n integers.



Thomas P. Kelliher
Thu Feb 6 14:19:05 EST 1997
Tom Kelliher