LinearSearch
Developed by Michael P. Epstein
How to use this applet
To start a search going, press the Play button. The search can
then be paused by pressing the Pause button (which the Play
button becomes once a search starts). The search can be stopped
by pressing Stop. Pressing Frame Advance when the search is
paused or stopped moves the search forward by one element in the
array. Pressing Reset will set the search back to the beginning,
put new values in the array, and create a new target value.
To change the target value for a search, just type an integer
into the "Target Value" field. Note that because the array being
searched consists of integers, the target value should also be
an integer. The target value may not be changed while a search
is in progress.
To change the size of the array, adjust the slider in the
lower left portion of the applet so that it is set to the
desired size. The size ranges from 1 element to 10 elements.
For additional help, click the "Help" button in the applet
above.
Concepts stressed in this applet
This applet illustrates the operation of a linear search
algorithm and the concept of an invariant, which is a
condition that does not change during a program segment's
execution. For more information, click the "Info" button in the
applet above.
Source Code Files