07-04-2003, 09:25 AM
Quote:If I wanted to generate strings of zeros and ones, I could add 3 or 4 lines of code to do this (I think I posted this somewhere before). But the point is that I don´t want to generate strings of 0 and 1, I want to generate bytes or words.
Thats not what I said. I said the algorithms /work/ differently, your algorithm directly generates integer numbers, the algorithm I gave generates strings of ones and zeros by calculating one bit of the string at time. Conversion from string form to integer form and vice-versa is trivial. My algorithm is also general purpose, it can be used for /any/ byte length, yours can only be used for byte lengths that have a power of two. Whether or not a commercial application requires arbitary byte length is a different matter entirely, the point is that your algorithm is faster and simpler than the one I gave, but is far more limited.
Quote:Also at issue here is the fact that I have used this algorithm twice in business for practical applications, not just for academic purposesHow is this "at issue"? I never said that your algorithm is useless, indeed for a commercial application that only required generation of gray codes with a power of 2 byte length, your algorithm is definitely a sensible choice. However if a more general purpose solution is required to generate n-bit Gray codes, then your algorithm is no longer suitable.
Quote:Sorry, but I don't quite understand the rest of your argument.Which part?
esus saves.... Passes to Moses, shoots, he scores!