Algorithms and Data Structures for Programming Contests
Brute Force Algorithms
Discussion
What is it?
- Conceptually, "brute force" = "try every possibility".
Advantage(s)?
- Obvious correctness of solution.
Disadvantage(s)?
- It can be tricky to generate every possibility exactly once.
- Often, it is inefficient — more on this later.
Try it!
- Try the
"Stacks of
Blocks"
problem from the DWITE programming contest.
- Ignore issues of input/output for now:
suppose you already have the data stored
in an appropriate data structure of your choice.
© Copyright 2012–2015 François Pitt
<francois.pitt@utoronto.ca>
last updated at 08:24 (EST) on Thu 5 Mar 2015
Algorithms and Data Structures by
François Pitt is licensed under a
Creative
Commons Attribution-ShareAlike 4.0 International License.