The absolute difference is the positive difference between two values and , is written or and they are equal. If and , . Given an array of integers, find the minimum absolute difference between any two elements in the array.
There are pairs of numbers: and . The absolute differences for these pairs are , and . The minimum absolute difference is .
Complete the minimumAbsoluteDifference function in the editor below. It should return an integer that represents the minimum absolute difference between any pair of elements.
minimumAbsoluteDifference has the following parameter(s):
int arr[n]: an array of integers
int: the minimum absolute difference found
The first line contains a single integer , the size of .
The second line contains space-separated integers, .
Sample Input 0
33 -7 0
Sample Output 0
The first line of input is the number of array elements. The array, There are three pairs to test: , , and . The absolute differences are:
Remember that the order of values in the subtraction does not influence the result. The smallest of these absolute differences is .