1. ## newbie help

I'm to write an algorithm called "Quine-McKlusky" algorithm that minimizes logic function for digital hardware synthesis.

I need to minimize codeword, that's in binary....

for example, if I have

1001 (in binary string)
1011 (in binary sting)
------------
10_1 (? )

only the difference of 1 bit is detected and result should be 10_1. '_' indicating where the bit difference is located.

which route should I go to achieve this?

thinking I sould use array, since I my have hundreds of those to compare each other and store the result somewhere.

2. You should use a vector<string> to store your results. A vector is like an array, but it starts at size 0, and it grows to whatever size you need as you add elements.

3. another,
when I compare two binary strings given in the example, should I compare bit by bit as a character?

4. You should compare the data as it is. Use bitwise OR and cast the return as an int. It will basically return the total of unmatched bits in decimal. There is no reason to turn a single byte into 8 bytes by converting it into a character string. Escpecially if you're trying to minimize codeword.

5. Originally Posted by SlyMaelstrom
You should compare the data as it is. Use bitwise OR and cast the return as an int. It will basically return the total of unmatched bits in decimal. There is no reason to turn a single byte into 8 bytes by converting it into a character string. Escpecially if you're trying to minimize codeword.

OK.

Is there a way to represent binary numbers in real binary? not like what I thought I should by representing it in strings of zeros and ones. Then just logical OR or AND will make my life easier.

basically, I first have inputs in decimal as the min-terms of a function. Then I have to convert those minterms to binary codewords to compare each one of them to the others to detect the ones that are differ only by 1 bit.