40 20 10 30
If array elem < min set min to that elem
Visiting | Condition (elem<min) | Answer | New "min" |
---|---|---|---|
40 | 40 < 40 | false | 40 |
20 | 20 < 40 | true | 20 |
10 | 10 < 20 | true | 10 |
30 | 30 < 10 | false | 10 |
set var "min" to first list value iterate the list If array elem < min set min to that elem
if the list is empty return null set var "min" to first list value iterate the list If array elem < min set min to that elem
set min to the first value iterate the array If array elem < min set min to that elem