in this piece of code bit masking technique and XOR operation are used, could you please explain me about these techniques and what's the alternative ways instead of these methods?
and in the following code also bit masking technique is used, and why 2 for loop is used here? whats the meaning of this lines:Code:for (i = 1; i <= n; i++) { if (i == pow(2, p)) { Final[i] = 0; p++; } else { Final[i] = b[j]; j++; } } if ((i&j) == i) Final[i] ^= Final[j];
Code:for (i = 1; i < pow(2, r); i = pow(2, x)) { for (j = 1; j <= n; j++) { if ((i&j) == i) Final[i] ^= Final[j]; } x++; std::cout << std::endl << i <<" " <<Final[i] ; }




Reply With Quote
