To hand in on paper in class:
Rosen, Section 4.1, pp. 280-82: Exercises 10 and 56
Section 4.2, p. 292, Exercise 8
Section 4.3, p. 309, Exercises 26ab
Find a loop invariant for the following subroutine and use it to prove that the subroutine is correct:
sub find_max {
my(@nums) = @_;
my($max) = $nums[0];
for (my($i)=1; $i<@nums; $i++) {
if ($nums[$i]>$max) { $max = $nums[$i]; }
}
return $max;
}
The assignment is worth 100 points.