
86 Design and Analysis of Algorithms
Algorithm 4.11 Algorithm max(A, n, j)
1 [ find maximum of n items in an array, put it in amax and its index in j ]
2 amax ← A[1];
3 j ← 1;
4 for i ← 2 to n do
5 if A[i] > amax then
6 amax ← A[i];
7 j ← i;
8 end
9 end
4.10 Develop the required algorithms to read-in
the values of the height of the students in
your class, then calculate the mean, standard
deviation, and variance of these values and
print them as outputs. Implement the program
in JAVA or C. The program should adhere to
the suggestions regarding effi ciency, given in
the text. Prepare the documentation for the
program.
4.11