-
October 21st, 2015, 05:38 PM
#1
Merge lines using XOR operations bits
Hi
I need to do an algorithm that read a textfile have 14 Characters (Numbers 1 to 7)
Example:
44444444444444
44444444444442
14444444444444
42444444444444
..ETC
I must read each line and find lines with difference 1 or 2 characeters, in example above the first line and second line have difference
one character I must to do a XOR in each position
doing in first and second line
Each line can use only 1 time
The lines used can not to use again , then first and second line can not to used
44444444444446
But each row will can in maxime two symbols differents of the (1, 2 and 4)
44444444444446 have only one symbol ( 6) , then I must to read others line to find more row with one difference
Doing XOR between 44444444444446 and 14444444444444
See that the number 6 in bit format is
110 ==> 6
and the number 4 in bit format is
100 ==> 4
Then 6 contain 4 then will can to do XOR in each column
544444444444446 , Now This line have two symbols differente of the (1,2 and 4 ) , 5 and 6 then It do not need in others rows,
but the rows used
44444444444444
44444444444442
14444444444444
Can not to used again , Someboy can to help me to do a algortihm to read each row and to do operations with bits
what best language ?
I know a little VB and learning Python
-
October 24th, 2015, 12:49 AM
#2
Re: Merge lines using XOR operations bits
Originally Posted by muttleychess
and learning Python
I don't quite understand what you are asking but you seem to know what you want to do and how to do it using XOR.
It looks like Python is supporting bitwise operations and since you're learning that language why not use it? Then if you have more specific questions regarding implementation you can ask at a Python forum.
https://wiki.python.org/moin/BitwiseOperators
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|