HappyLittlePony's blog

By HappyLittlePony, 9 years ago, In English

Simple question:How to write easy-to-implement brute force solutions? Which techniques do you use (like using next_permutation)?

Thank you for all answers:-)

  • Vote: I like it
  • +5
  • Vote: I do not like it

| Write comment?
»
9 years ago, # |
  Vote: I like it -13 Vote: I do not like it

In this case : B r u t e f o r c e

Thank do not need ((:

»
9 years ago, # |
  Vote: I like it +1 Vote: I do not like it

For brute-force I use recursion 90% of the time. If you are brute-forcing something which state can be described by a permutation, then sure — go with next_permutation.

But in general brute-force is not algorithm but an approach so it's hard to give you any real advice that will always work. In general I use backtracking with recursion and that's the most standard approach.