BRUTE FORCE
\bɹˈuːt fˈɔːs], \bɹˈuːt fˈɔːs], \b_ɹ_ˈuː_t f_ˈɔː_s]\
Sort: Oldest first

A primitive programming style in which theprogrammer relies on the computer's processing power insteadof using his own intelligence to simplify the problem, oftenignoring problems of scale and applying naive methods suitedto small problems directly to large ones. The term can alsobe used in reference to programming style: bruteforceprograms are written in a heavyhanded, tedious way, full ofrepetition and devoid of any elegance or useful abstraction(see also brute force and ignorance).The canonical example of a bruteforce algorithm isassociated with the "travelling salesman problem" (TSP), aclassical NPhard problem:Suppose a person is in, say, Boston, and wishes to drive to Nother cities. In what order should the cities be visited inorder to minimise the distance travelled?The bruteforce method is to simply generate all possibleroutes and compare the distances; while guaranteed to work andsimple to implement, this algorithm is clearly very stupid inthat it considers even obviously absurd routes (like goingfrom Boston to Houston via San Francisco and New York, in thatorder). For very small N it works well, but it rapidlybecomes absurdly inefficient when N increases (for N = 15,there are already 1,307,674,368,000 possible routes toconsider, and for N = 1000  well, see bignum). Sometimes,unfortunately, there is no better general solution than bruteforce. See also NPcomplete.A more simpleminded example of bruteforce programming isfinding the smallest number in a large list by first using anexisting program to sort the list in ascending order, and thenpicking the first number off the front.Whether bruteforce programming should actually be consideredstupid or not depends on the context; if the problem is notterribly big, the extra CPU time spent on a bruteforcesolution may cost less than the programmer time it would taketo develop a more "intelligent" algorithm. Additionally, amore intelligent algorithm may imply more longterm complexitycost and bugchasing than are justified by the speedimprovement.When applied to cryptography, it is usually known as bruteforce attack.Ken Thompson, coinventor of Unix, is reported to haveuttered the epigram "When in doubt, use brute force". Heprobably intended this as a ha ha only serious, but theoriginal Unix kernel's preference for simple, robust andportable algorithms over brittle "smart" ones does seem tohave been a significant factor in the success of thatoperating system. Like so many other tradeoffs in softwaredesign, the choice between brute force and complex,finelytuned cleverness is often a difficult one that requiresboth engineering savvy and delicate aesthetic judgment.
By Denis Howe