Brute-force search
Brute-force search is a search technique that systematically evaluates candidates in a defined search space, typically examining all possibilities without using selective shortcuts to narrow the search.
Optimization Algorithms: AI techniques for design, planning, and control problems
A graph-search strategy that explores states without using problem-specific information to prioritize promising alternatives.
- How it is used
- Uses blind search to explore graphs and find routes when goal-directed information is unavailable.
- How deep it goes
- Explains traversal rules and exhaustive comparison, then compares shortest-path algorithms and routing implementation caveats.
- Examples
- Compares routes through Toronto and examines parallel edges and self-loops in map-derived graphs.
- What you can do after
- Apply it via NetworkX or optalgotools to compare graph-search routes and their resource trade-offs.
Advanced Algorithms and Data Structures
Brute-force search exhaustively examines the available candidates to find results without using an indexing or pruning strategy.
- How it is used
- Uses exhaustive evaluation to solve constrained selection problems and assign points to their nearest k-means centroids.
- How deep it goes
- Explains enumeration, filtering, and selection, then contrasts repeated point-centroid comparisons with k-d-tree acceleration.
- Examples
- Uses Mars food packing and k-means point-to-centroid classification, supported by combination counts, pseudocode, and runtime comparisons.
- What you can do after
- Apply it via exhaustive enumeration for small candidate sets and evaluate when indexing or pruning is necessary.
Read how Advanced Algorithms and Data Structures explains brute-force search →
Grokking AI Algorithms, Second Edition
A brute-force approach systematically evaluates every possible combination or candidate in a problem's search space.
- How it is used
- Frames exhaustive search as a baseline for navigating trees, networks, web pages, social connections, and constrained combinations.
- How deep it goes
- Explains traversal order, visited-state tracking, iterative tree generation, and exhaustive knapsack evaluation, but avoids implementation code.
- Examples
- Uses maze paths, network routing, web crawling, social connections, and knapsack item combinations as concrete examples.
- What you can do after
- Evaluate small search spaces exhaustively while preventing cycles and comparing valid candidates for an optimal result.
Read how Grokking AI Algorithms, Second Edition explains brute-force search →
Classic Computer Science Problems in Swift: Essential techniques for practicing programmers
Brute-force search systematically examines many or all possible candidates until a valid solution is found.
- How it is used
- Solves small or moderate search and constraint problems by enumerating candidates and testing them.
- How deep it goes
- Explains candidate representation, recursive permutation generation, backtracking, validation, and result selection, while showing poor scalability.
- Examples
- Uses a five-city traveling salesman instance and the SEND+MORE=MONEY cryptarithmetic puzzle.
- What you can do after
- Build it from scratch in Swift by generating permutations, evaluating routes, and enforcing puzzle constraints.
Algorithms Every Programmer Should Know
Brute force is a problem-solving technique that straightforwardly examines possible solutions without applying problem-specific optimization.
- How it is used
- Starts algorithmic problem solving with a straightforward solution before optimization.
- How deep it goes
- Explains exhaustive assignment checking through permutations and contrasts its growth with the Hungarian algorithm.
- Examples
- Uses worker-task matching to compare six pairings for three workers with 100! possibilities for 100.
- What you can do after
- Evaluate when exhaustive matching becomes impractical and why a more efficient algorithm is useful.
Read how Algorithms Every Programmer Should Know explains brute-force search →
Hacking Cryptography
A brute-force search systematically tests possible candidates until one satisfies the required conditions.
- How it is used
- Uses exhaustive candidate testing to simplify an LFSR-recovery exploit when a more efficient algorithm is harder to understand.
- How deep it goes
- Demonstrates candidate enumeration, matrix inversion, decryption, and validation, stopping short of deriving the more efficient Berlekamp–Massey algorithm.
- Examples
- Demonstrates recovery from an ATTACK AT prefix and validates the decrypted timestamp against a concrete test message.
- What you can do after
- Diagnose and exploit recoverable LFSR ciphertext by testing lengths, reconstructing taps, and validating decrypted plaintext.
Machine Learning Algorithms in Depth
Complete search is a problem-solving technique that traverses an entire search space to find a solution, optionally pruning parts known not to contain one.
- How it is used
- Uses exhaustive enumeration as a general problem-solving paradigm and as a foundation for implementing algorithms from scratch.
- How deep it goes
- Defines exhaustive traversal, pruning, recursion, and iteration, then demonstrates both implementations for subset generation.
- Examples
- Demonstrates recursive and bit-sequence subset generation and exact inference by complete enumeration over probability tables.
- What you can do after
- Build it from scratch using recursive branching, termination checks, pruning, backtracking, or bit-sequence enumeration.
Read how Machine Learning Algorithms in Depth explains brute-force search →
Natural Language Processing in Action, Second Edition
A brute-force search algorithm evaluates candidates directly, typically examining all available possibilities to find a match or optimum.
- How it is used
- Uses direct comparison to select chatbot responses or retrieve semantically closest documents.
- How deep it goes
- Explains candidate comparison, similarity measures, and O(N) scaling, but defers efficient indexing and approximate-search implementations.
- Examples
- Uses ChatterBot statement–response matching and document-vector comparison as concrete applications.
- What you can do after
- Evaluate when exact candidate comparison is practical and recognize when corpus size makes approximate retrieval preferable.
Read how Natural Language Processing in Action, Second Edition explains brute-force search →
Also covered in
- Build AI Drug Discovery PipelinesIn early access (MEAP)
- Quantum Programming in Depth
- Deep Learning with R, Third Edition
- The Creative Programmer
- .NET in Action, Second Edition
- How Large Language Models Work
- Software Design for Python Programmers
What to know first
- language modelA language model is a computational model that represents patterns in linguistic sequences to assign probabilities, predict, generate, or evaluate language.
- routingRouting is the process of directing an item, request, or task to a destination or processing path according to relevant rules or characteristics.
- costCost is the monetary expenditure or other resource burden incurred to acquire, produce, operate, or perform something.
- distanceA distance function assigns a numerical measure of separation or dissimilarity to pairs of points or objects in a defined space.
Related concepts
- similarity searchkind of · Similarity search is a retrieval technique that finds or ranks items by their similarity to a query, often by comparing feature or vector representations under a similarity or distance measure.
- determinismkind of · Determinism is the property that the same relevant inputs, state, and conditions uniquely determine the same outcome or behavior.
- Dijkstra's algorithmincludes · Dijkstra's algorithm computes shortest paths from a source vertex in a weighted graph with nonnegative edge weights.
- informed searchcontrasts with · Informed search is a search strategy that uses problem-specific knowledge or heuristic estimates to prioritize promising states or paths.
- k-d treealternative to · A k-d tree is a binary space-partitioning tree that organizes points in multidimensional space by recursively comparing coordinate dimensions.
- Knuth-Morris-Pratt algorithmcontrasts with · The Knuth-Morris-Pratt algorithm is a string-search procedure that avoids rechecking previously matched text characters by using information about the pattern's prefixes and suffixes.
Questions about brute-force search
What is brute-force search?
Brute-force search is a search technique that systematically evaluates candidates in a defined search space, typically examining all possibilities without using selective shortcuts to narrow the search.
Which Manning books explain brute-force search?
Optimization Algorithms: AI techniques for design, planning, and control problems, Advanced Algorithms and Data Structures, Grokking AI Algorithms, Second Edition, Classic Computer Science Problems in Swift: Essential techniques for practicing programmers, Algorithms Every Programmer Should Know, Hacking Cryptography, Machine Learning Algorithms in Depth and Natural Language Processing in Action, Second Edition.
What should I know before learning brute-force search?
Manning books that teach brute-force search usually introduce language model, routing, cost and distance first.
What is the difference between brute-force search and informed search?
Brute-force search is a search technique that systematically evaluates candidates in a defined search space, typically examining all possibilities without using selective shortcuts to narrow the search. Informed search is a search strategy that uses problem-specific knowledge or heuristic estimates to prioritize promising states or paths.
What kinds of brute-force search are there?
Kinds of brute-force search include Dijkstra's algorithm.
What is brute-force search a kind of?
Brute-force search is a kind of similarity search. Similarity search is a retrieval technique that finds or ranks items by their similarity to a query, often by comparing feature or vector representations under a similarity or distance measure.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.







