I have to find maximum value of exclusive xor among the elements of subsets of an array. I have to check every subset of the array and the subset which will yield maximum xo
I guess that you're referring to this question.
Gaussian Elimination is the algorithm description that I would expect from the math site. This is what the algorithm looks like in Python.
def max_xor(iterable):
array = list(iterable) # make it a list so that we can iterate it twice
if not array: # special case the empty array to avoid an empty max
return 0
x = 0
while True:
y = max(array)
if y == 0:
return x
# y has the leading 1 in the array
x = max(x, x ^ y)
# eliminate
array = [min(z, z ^ y) for z in array]