CS107 - Lab 3
Due Tuesday 09/28 at the beginning of class.
Given an algorithm that solves a problem, how do we measure its
efficiency? How do we know that one algorithm is more efficient than
another? This lab helps us to understand the measurement of algorithm
efficiency and its importance.
In this lab you will cover:
- Access the data-cleanup simulator that come with the course
software and play with it to better understand the algorithms.
- Answer questions regarding the algorithms discussed in class
(sequential search, data-cleanup) and their efficiency.
The reading for this lab is Chapter 3 in the textbook.
Course software
Following the same steps that you used for Lab 2, double-click
the icon csci107 - Invitation (OSX) that you copied to the
desktop. The following menu should appear:
The buttons Data Cleanup Animator will be useful for
this assignment. When you select either of these, you will be able to
animate the behavior of several different algorithms in Chapter 3.
For example, select Algorithm -> Shuffle Left in the Data
Cleanup Animator and then select the Run button. You may Reset and
Rerun this exercise several times to get a feeling for how the
shuffle left algorithm works. Its behavior should be familiar from our
discussions in class.
Now select Algorithm -> Converging Pointers, and then
select Run again. Note the behavior of this new algorithm for
each of several different sets of data values (using Reset and
Run several times).
These animators will be useful for answering some of the
questions below.
Designing and analyzing algorithms
Complete exercises 1, 3, 4, 5, 11, 13, 14, 15, 19, 20, 27, 28 at the
end of chapter 3 of your textbook (page 119-120).
What to turn in:
- The Designing Algorithms section.
Be sure to justify your answers! You may do this work either with
a word processor or by hand. If you type your solutions, bring a hard
copy of your assignment and hand it in class. If you write by hand, do
your best at writing legibly and leave space between problems.
You may choose to do this assignment either by yourself or in a
group. However, solutions should be written up individually and handed
in on Tuesday, at the beginning of class.
Once you are finished in the lab, if you saved any
documents in yout collaboration personal directory, be sure to drag
the
csci107 icon to the Trash (this step disconnects you
from the server and prevents someone else, who may use this iMac later
in the day, from accidentally accessing files in your personal folder) and log out!