Summary: Written 2 Page 1
CS 2420 Written 2
Due Sept 22, 2010 **DUE AT CLASSTIME**
Turn in your written homework in class by folding it in half lengthwise and putting your names on the outside or submit the
homework through Eagle.
Note, these exercises may be done in groups of one, two, or three. If more than one person is involved, list all the names on one
set of answers. Groups may change throughout the semester. Answers should not be compared with others not in your group.
You will learn much more by working in a group than you will learn working by yourself.
1. The terminology f(n) is O(n2
) is equivalent to saying f(n) is of order n2
or saying f(n) is of
. For each program segment (a-d) shown below:
a. Find the complexity
b. Select an appropriate picture from the list below (A-F) (or draw one of your own)
to justify your answer.
a. for (int k = 0; k
for (int j = 0; j < k; j++) // Notice j ends at k (not n)
cout << k << j;