Respuesta :
Answer:
min = a_1
for i:= 2 to n:
if [tex]a_i[/tex] < min then min = [tex]a_i[/tex]
return min
Step-by-step explanation:
We call the algorithm "minimum" and a list of natural numbers [tex]a_1, a_2, \cdot\cdot\cdot, a_n.[/tex]
So lets first set the minimum to [tex]a_1[/tex]
min = a_1
now we want to check all the other numbers.
We can use a simple for loop, to find the minimum
min = a_1
for i:= 2 to n:
if [tex]a_i[/tex] < min then min = [tex]a_i[/tex]
return min
Answer:
The sequence of natural numbers is a_1, a_2, a_3, ..., a_n.
Use min as the variable that will contain the minimum value.
Set min = a_1
In a loop, compare min to each number from a_2 to an.
If min > a_i, then let min = a_i
min = a_1
for i = 2 to n
if min > a_i, then min = a_i