## Question-58

**Question-58**

What of the following is an algorithm that locates the first occurrence of the largest element in a finite list of integers? The integers in the list are not necessarily distinct.

**Solution**

procedure** first largest ( a _{1 , }a_{2 , ……… , }a_{n : integers})**

**max = a _{1}**

**location = 1**

**for i = 2 to n**

** if max < a _{i} then**

** max = a _{i}**

** location = i**

**return location**