Hashmap which stores the indexes of the input array
HashMap < Integer , Integer > h = new HashMap < Integer , Integer > ( ) ; Arrays . sort ( temp ) ; for ( int i = 0 ; i < N ; i ++ ) { h . put ( arr [ i ] , i ) ; } for ( int i = 0 ; i < N ; i ++ ) {