Chapter 3: Q20E (page 202)
Describe an algorithm for finding both the largest and the smallest integers in a finite sequence of integers.
Short Answer
Algorithm that produces the minimum(smallest) and maximum(largest) integers in a finite sequence of integersis:
proceduremin and max ( : integers with ).
role="math" localid="1668421689261"
for to n
If then .
for to n
If then .
returnmin, max