See the assignment turn-in page for instructions on turning in your assignment.
For example, given the array
{ 1, 2, 3, 1, 2, 4, 6 }
{ 1, 2, 3 }
is a sample of size 3 and { 3, 1, 2, 4 }
is a sample
of size 4. { 2, 3, 1, 2 }
is not a sample because the value 2
is
repeated.
A maximal sample is a sample of an array that is at least as large as
any other sample of the array. In the previous example, { 3, 1, 2, 4, 6 }
is a maximal array sample. An array may have more than one maximal sample; for
example the array
{ 1, 2, 3, 3, 3, 2, 1 }
{ 1, 2, 3 }
and { 3, 2, 1 }
.
sample find_maximal_sample(const int a[], int a_size);
a
containing
a_size
integers. If a
contains more than one maximal sample,
find_maximal_sample()
can return any of them.
mas.h
contains the prototype for find_maximal_sample()
and
the definition for sample
. You can compile your procedure source with the
file test-mas.o
to test your code. You can download mas.h
and
test-mas.o
from a browser (shift-left-click on the link) or access them
directly from the directory
/export/home/us/csfac/cs176-summer2001/pa/3
from any PC lab machine running linux or from rockhopper.
This page last modified on 18 June 2001.