Summary: Written 1 Page 1
CS 2420 Written 1
Understanding how work grows with the problem size
For each of the following pieces of code, the number of characters that are printed corresponds to
the amount of work that is done.
1. For each method in Written1.cpp:
(a) Run the code for various values of N = 2,4,8,16,32.
(b) Count how many characters are printed for each value of N.
(c) Using Excel, chart the number of characters as a function of N. The following handout
will be helpful: http://www.cs.usu.edu/~allan/DS/Files/ExcelComplexity.pdf
(d) Explain what the relationship is between N and the amount of work. For example, you
might say, "The work to perform doit varies directly with N. In other words, as N
doubles, so does the work."
Include your results, your charts, and your explanation of how work varies with the size of the
2. Using csilm.usu.edu, go to CS3 and experiment with the Array Searching ILM. This ILM
allows you compare searching times for three different types of arrays: Unsorted/linear,
Sorted/Linear, and Sorted/Binary. Watch the demo to see how to use it. The buttons "Prev" and
"Next" take you through various exercises.