??? 12/15/06 08:27 Read: times |
#129528 - it's sometimes not easy to describe what one needs Responding to: ???'s previous message |
A bit of philosophy rather than engineering:
A list of a all numbers from 0 to 65535, sorted by how many bits are set I see no limitation in using an algorithm generating a proper sequence: if this "list" has to be output to a file, it's easy; if it has to be in an array in memory it's easy to redirect there. In fact, the result is exactly the same, just producing a sequence in this case could be possibly more memory efficient if the resulting "list" should not be stored in memory; and the sorting approach is more general/flexible e.g. does work even if a different set of numbers (than the whole range 0-65535) has to obey the given rule. This is often the case in programming, that there are different approaches to the problem with different requirements and different possible future reusage - this is why the "old boys" are able to produce generally better programs - they already have seen so many different things that they have better insight and oversight... But the question is, whether they won't simply get tired or die before they reach this level of perfection... I think the same happens in real life. :-) JW |