Question

Describe an algorithm that takes a list of integers a1, a2, ..., an (n > 2) and finds the second-largest integer in the sequence by going through the list and

keeping track of the largest and second-largest integer encountered.

Fig: 1