I'm working on an exercise currently regarding Sorting Algorithms. The actual exercise is structured like this:
Given a sequence of N real numbers, find the pair of integers that are farthest apart in value. Give a O(N) algorithm. Describe your proposed algorithm in English.
I am not familiar currently with any linear sorting algorithms, so I wanted to ask here about it. Is there a specific type of sorting algorithm that would work best in this situation? If so, what is it and how does that particular algorithm work?
Thanks!