c语言概率算法简介(Introduction to probabilistic algorithms for c languages)
c语言概率算法简介(Introduction to probabilistic algorithms for c languages)
Probability algorithm
Each calculation step of many algorithms are fixed, the probability algorithm and below we discuss the algorithm allows the selected at random during the execution of a calculation procedure. In many cases, when the algorithm has a choice in the implementation process, the random choice is often the optimal choice of time. Therefore the probability algorithm can reduce the complexity of the algorithm to a great extent.
A basic feature of probability algorithm is the same example for solving the problem with the same probability algorithm two may be completely different results. The two problem of the time required and the results obtained may be quite different. In general, the probability algorithm is broadly divided into four categories: numerical probability algorithm, Monte Carlo (Monte
Las Vegas (Las Carlo) algorithm, Vegas algorithm) and Sherwood (Sherwood) algorithm.
The numerical algorithm used in numerical problems in probability. This kind of algorithm are often approximate solution. But the accuracy of the approximate solution with the increase of computing time increasing. In many cases, to calculate the exact solution of the problem is not possible or not necessary, it can be quite a satisfactory solution with numerical probability algorithm.
Monte Carlo algorithm is used to solve the problem of accurate. For many problems, the approximate solution is meaningless. For example, a decision problem and its solution is "yes" or "no", the two will be one, there is not any approximate solution. Again, we require an integer factor when given the answer must be accurate, approximation factor of an integer without any meaning. A solution by using the Monte Carlo algorithm can find the problem, but the solution is not necessarily correct. The probability of correct solutions used in the algorithm of time dependence. The more time used by the algorithm, get the higher probabi