Function to sort an array according absolute difference with x .
static void rearrange ( int [ ] arr , int n , int x ) { SortedDictionary < int , List < int > > m = new SortedDictionary < int , List < int > > ( ) ;