Minimum Absolute Difference in an Array

  • + 0 comments

    The values that are closest to one another are the ones that will have the least difference.

    After sorting I know that for any value, i , the values at i-1 and i+1 are closest to i.Therefore, I dont have to consider all pairs that contain, i, I can just consider the ones that are going to yield the least difference, i's neighbors. Everyone else is farther away.