26.1k views
4 votes
provide pseudocode to find the smallest number in an array of ints. what is the runtime of your code?

1 Answer

1 vote

Answer:

remember first element in the array as smallest

interate through array, for each number:

if it is smaller than the remembered smallest, remember this number in stead

Step-by-step explanation:

The order of this algorithm is linear, which means the run time of the code increases linear with the size of the array.

User Guo Luchuan
by
8.1k points