Describe an algorithm for finding the smallest integer in a finite sequence of natural numbers.
2 answers:
Answer:
min = a_1
for i:= 2 to n:
if < min then min =
return min
Step-by-step explanation:
We call the algorithm "minimum" and a list of natural numbers
So lets first set the minimum to
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 < min then min =
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
You might be interested in
Yes they are equal they both have a side that is 25 degrees
Answer:
B. 5.00
Step-by-step explanation:
:)
Answer:
Step-by-step explanation:
Answer:
no it doesnt
Step-by-step explanation: