1. Home
  2. Computing & Technology
  3. C / C++ / C#

Definition of Brute Force

By , About.com Guide

Definition: Brute force is a crude algorithm which works through every possible answer until the correct one is found. Some problems can be solved this way but others- for instance obtaining the prime factors of large numbers or picking the best chess move, have far too many possibilities to be solved that way except in simple cases.

For example, searching an unsorted array to find the location of a value can be done in an average of n/2 searches if there are n elements in the array, That's linear in Big-O Notation. But if you sort the array first and use a binary chop algorithm, then the search shortens to an average of Log2(n ) comparisons. An array of 1024 sorted values can be found in 10 comparisons or less.

Glossary:

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Examples:
Many entries in the Programming challenge #1 use a brute force approach.
Explore C / C++ / C#
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. C / C++ / C#

©2009 About.com, a part of The New York Times Company.

All rights reserved.