Question: 2. Take it to the max: Here is an algorithm for finding the maximum element of a list of n things: Input: a list of

2. Take it to the max: Here is an algorithm for finding the maximum element of a list of n things: Input: a list of real numbers a1,,an. Output: a maximum element from the list. 1: max_sofar a1 2: for i=1 to n: 3: if ai> max_so_far : 4: max_sofar ai 5: return max_so_ar What is the big-O running time of this algorithm in terms of the length n of the input list
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
