Now divide elements into two sets by comparing a rightmost set bit of xor1 with the bit at the same position in each element . Also , get XORs of two sets . The two XORs are the output elements . The following two for loops serve the purpose
for ( i = 0 ; i < n ; i ++ ) { if ( arr [ i ] & set_bit_no )