Question: Question 5: Given an unsorted array, give an algorithm that finds the two (different) indices i and j so that |A[i] A[j]| is minimum. Example
Question 5: Given an unsorted array, give an algorithm that finds the two (different) indices i and j so that |A[i] A[j]| is minimum. Example A =< 3, 11, 6, 19, 15 >. In this case the best indices are i = 1 and j = 3. |A[1] A[3]| = 3 is the minimum possible.
Please answer with an explanation of the algorithm in words.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
