Question:
Using a Linear Search to Find the Smallest Element in a List
Please help with the following problem.
Figuring out how to determine the last element of the print statement. For array A(N) and input element ARG, what kind of algorithm is needed to determine which element of A(N) is closest to but not greater than ARG? I've gotten this far but can't find anything in my course manual that describes this situation.
If A(1) < ARG > A(N) then
CODE = 2
Print ARG, CODE, A(N) that is closest to but not greater than ARG