究竟是蛮力算法算法、是蛮力

2023-09-11 03:16:52 作者:稳妥一个萌妹

究竟是蛮力算法? (除了刚才的方法只)

在一个问题,可以使用蛮力的方式,什么时候不用?

什么样的​​特点是在有一个算法,当算法采用暴力方法?

解决方案

1和3:强力手段您将通过所有可能的解决方案广泛地。例如,在一个国际象棋游戏,如果你知道你可以赢得两个动作,蛮力将经过举动所有可能的组合,而不采取任何考虑。就这样,小棋子在后面不能影响结果,仍然会被考虑的。

2:当你考虑一切,问题很快失去了控制。通过15个动作蛮力在国际象棋是不可能的,因为组合爆炸(太多的情况下,要考虑)。然而,更聪明的算法,考虑到知识问题可以走得更远(20-30向前移动)

编辑:澄清,蛮力是最简单的(最愚蠢?)的方式来探索解决的空间。如果你有一个问题被设定在一个可数空间(棋是可数的,密码是可数的,连续的东西是不可数)蛮力将探讨这个空间考虑所有的解决方案一样。在国际象棋的例子,你想将死你的对手。这是通过一序列的动作,这是可数的完成。蛮力将通过招式全部序列,但不太可能他们可能。这个词不太可能是很重要的,因为这意味着,如果你有知识,关于您的问题(你知道什么是不可能成为解决方案,如牺牲你的女王),你可以做的比蛮力要好得多。

what exactly is the brute force algorithm? (besides just the approach only)

编程中的算法到底是怎么一回事 用这个APP孩子也能看懂

when a problem can use brute-force approach, and when not to?

What characteristics are there in an algorithm, when the algorithm uses brute force approach?

解决方案

1 and 3 : Brute force means that you will go through all possible solutions extensively. For example, in a chess game, if you know you can win in two moves, the brute force will go through all possible combination of moves, without taking anything in consideration. So the little pawn in the back that cannot influence the outcome will still be considered.

2 : As you consider everything, the problem quickly goes out of control. Brute force through 15 moves in chess is impossible because of combinatorial explosion (too many situations to consider). However, more clever algorithms that take into account "knowledge about the problem" can go much further (20-30 moves ahead)

Edit : To clarify, brute force is simplest (dumbest?) way to explore the space of solutions. If you have a problem is set in a countable space (chess moves are countable, passwords are countable, continuous stuff is uncountable) brute force will explore this space considering all solutions equally. In the chess example, you want to checkmate your opponent. This is done via a sequence of moves, which is countable. Brute force will go through all sequence of moves, however unlikely they may be. The word unlikely is important, because it means that if you have knowledge about your problem (you know what is unlikely to be the solution, like sacrificing your queen), you can do much better than brute force.