On Sun, Mar 29, 2015 at 9:35 PM, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: > Anyway, we don't really know where the confusion lies. Perhaps the > description is misleading, or I'm just confused, or Bart's idea of brute > force is not the same as my idea of brute force, or perhaps he really is a > super-genius who has casually relegated C to the dust bin of historic > languages...
Ah, I see what you mean. I tend to describe an algorithm as "brute force" even if it has a few simplifications and early cut-offs. A brute-force primality test, for instance, might divide the target number by every counting number since 1, looking for a remainder; does it cease to be brute-force if you check only 2 and odd numbers? only those up to its square root? Either of those tiny optimizations will give a dramatic speed improvement, without representing a flaw; and I would still consider them brute force. The purest form is a barbarian trying to lift a gate; the slightly-optimized is a wizard trying to lift the same gate; but neither algorithm is using a Knock spell to open it by magic. And if you've seen "The Gamers", you'll know that brute force is as fickle as a roll of the dice..... Point is, "brute force" isn't a pure absolute from which there can be no variation. ChrisA -- https://mail.python.org/mailman/listinfo/python-list