CS107 - Lab 3
Due Monday 09/29 at the beginning of class.
Overview:
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. You will access the data-cleanup and
sort simulator that come with the course software and play with them
to better understand the algorithms. The readings and problems for
this assignment are in Chapter 3 of your text.
Course software
Following the same steps that you used for Assignment 2, double-click
the icon csci107 - Invitation (OSX) that you copied to the
desktop. The following menu should appear:
The buttons Data Cleanup Animator and Sort
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.
Algorithmic Problem Solving
Complete exercises 1, 3, 4, 6, 8, 9, 10, and 11 on pages 109-110 of
your textbook.
Be sure to justify your answers! You may do this work either by
hand or with a word processor (e.g. MS Word). Also, 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 Monday,
at the beginning of class.
To submit a file electronically, you should first rename it so that
you are identified as the author (e.g., give it a name like
lab1-ltoma). Then drag the file to the csci107 -> Drop
Box folder. Be careful not to drag an entire folder into the
Drop Box; only a single file at a time can be submitted.