Program P1
assign r := min{u | (0 <=u<=z)
and com(u)}
end {P1}
- Directly suggested by specification.
- Correctness obvious.
- Efficiency low:
- Iterative check of 0 <=u<=z.
- Sequential complexity O(z).
- Parallel complexity O(log z) with O(z) processors.
Observation: com(u) need not be checked for t <=u<f(t).