svanidz1's blog

By svanidz1, 7 years ago, In English

Does there exist an algorithm, for a given sequence to find a sub-sequence with minimum possible xor? Or at least an algorithm finding a subsequence of xor==0?

 
 
 
 
  • Vote: I like it
  • +22
  • Vote: I do not like it

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

which asymptotic are you interesting about? For instance, one can use Meet-in-the-middle for second problem...

»
7 years ago, # |
  Vote: I like it +11 Vote: I do not like it

First thought: you can treat numbers like binary vectors and construct a matrix, where each row is a binary vector, corresponding to a particular number in sequence. Then you can perfrom Gaussian elimination modulo 2 on this matrix and if you have at least one all-zeroes row you can get xor == 0. If for each row R you also save indexes of rows interacted with row R during Gaussian elimination you can restore the corresponding subsequence.