Sort an array according to absolute difference with given value - GeeksforGeeks
Given an array of n distinct elements and a number x, arrange array elements according to the absolute difference with x, i. e., element having minimum difference comes first and so on.
Note : If two or more elements are at equal distance arrange them in same sequence as in the given array.
Read full article from Sort an array according to absolute difference with given value - GeeksforGeeks
No comments:
Post a Comment